Remove the lp_solve solver, which CoinMP makes redundant

The Lpsolve solver and the CoinMP solver are both used for the same
thing: a linear model, with optional integer variables by branch
and bound. CoinMP (CLP plus CBC) is the more capable and better
maintained of the two, so the lp_solve one adds a second bundled
dependency and a parallel copy of the solver code for no capability
the other lacks.

Remove the LpsolveSolver component, the bundled lp_solve external
(and its colamd dependency, which only lp_solve used), and all the
build, configure, packaging and license references to them.

A document may still name com.sun.star.comp.Calc.LpsolveSolver as
its engine. SolverSettings now reads that name as the CoinMP
solver, which solves the same model, so such documents keep
working.

The Calc solver test that exercised the engine now uses CoinMP. Its
knapsack model has a single optimal total value of 6987, which fills
the weight capacity of 1000 exactly and which CoinMP finds. The
lp_solve run had returned a suboptimal 6981, so the test now expects
the true optimum.

The build setup changes only take effect after re-running autogen.

Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: Ia14d8c491779873da6b0157aa524056275adf8f5
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/3810
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit e77738a7ca7d44fd9d1f852e26d46e3a6d60467b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208038
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Tomaž Vajngerl
2026-07-14 12:49:42 +02:00
committed by Xisco Fauli
parent 88d1c60b18
commit bfc9cfdecf
39 changed files with 19 additions and 1149 deletions
-1
View File
@@ -48,7 +48,6 @@ libwebp
libwps libwps
libzxing libzxing
loplugin loplugin
lpsolve
MAKEFLAGS MAKEFLAGS
mergelibs mergelibs
msgfmt msgfmt
-1
View File
@@ -170,7 +170,6 @@ $(WORKDIR)/download: $(BUILDDIR)/config_$(gb_Side).mk $(SRCDIR)/download.lst $(S
$(call fetch_Optional,LIBXML2,LIBXML_TARBALL) \ $(call fetch_Optional,LIBXML2,LIBXML_TARBALL) \
$(call fetch_Optional,XMLSEC,XMLSEC_TARBALL) \ $(call fetch_Optional,XMLSEC,XMLSEC_TARBALL) \
$(call fetch_Optional,LIBXSLT,LIBXSLT_TARBALL) \ $(call fetch_Optional,LIBXSLT,LIBXSLT_TARBALL) \
$(call fetch_Optional,LPSOLVE,LPSOLVE_TARBALL) \
$(call fetch_Optional,LXML,LXML_TARBALL) \ $(call fetch_Optional,LXML,LXML_TARBALL) \
$(call fetch_Optional,LZMA,LZMA_TARBALL) \ $(call fetch_Optional,LZMA,LZMA_TARBALL) \
$(call fetch_Optional,MARIADB_CONNECTOR_C,MARIADB_CONNECTOR_C_TARBALL) \ $(call fetch_Optional,MARIADB_CONNECTOR_C,MARIADB_CONNECTOR_C_TARBALL) \
-44
View File
@@ -2534,50 +2534,6 @@ endef
endif # ANDROID endif # ANDROID
endif # SYSTEM_LCMS2 endif # SYSTEM_LCMS2
ifneq ($(ENABLE_LPSOLVE),)
ifneq ($(SYSTEM_LPSOLVE),)
define gb_LinkTarget__use_lpsolve
$(call gb_LinkTarget_add_libs,$(1),-llpsolve55)
$(call gb_LinkTarget_add_defs,$(1),\
-DSYSTEM_LPSOLVE \
)
endef
else # !SYSTEM_LPSOLVE
define gb_LinkTarget__use_lpsolve
$(call gb_LinkTarget_use_package,$(1),lpsolve)
ifeq ($(COM),MSC)
$(call gb_LinkTarget_add_libs,$(1),\
$(gb_UnpackedTarball_workdir)/lpsolve/lpsolve55/lpsolve55.lib \
)
else
$(call gb_LinkTarget_add_libs,$(1),\
-L$(gb_UnpackedTarball_workdir)/lpsolve/lpsolve55 -llpsolve55 \
)
endif
$(call gb_LinkTarget_set_include,$(1),\
-I$(gb_UnpackedTarball_workdir)/lpsolve \
$$(INCLUDE) \
)
endef
$(eval $(call gb_Helper_register_packages_for_install,ooo,\
lpsolve \
))
endif # SYSTEM_LPSOLVE
else
gb_LinkTarget__use_lpsolve :=
endif # ENABLE_LPSOLVE
ifneq ($(ENABLE_COINMP),) ifneq ($(ENABLE_COINMP),)
ifneq ($(SYSTEM_COINMP),TRUE) ifneq ($(SYSTEM_COINMP),TRUE)
-1
View File
@@ -53,7 +53,6 @@ libraryNames = {
"liborcus": "orcus", "liborcus": "orcus",
"ltm": "libtommath", "ltm": "libtommath",
"clucene-core": "clucene-core", "clucene-core": "clucene-core",
"lp_solve": "lp_solve",
"hsqldb": "hsqldb", "hsqldb": "hsqldb",
"y-crdt": "y-crdt", "y-crdt": "y-crdt",
"sqlite": "sqlite", "sqlite": "sqlite",
-5
View File
@@ -94,8 +94,6 @@ export CPDB_CFLAGS=@CPDB_CFLAGS@
export CPDB_LIBS=@CPDB_LIBS@ export CPDB_LIBS=@CPDB_LIBS@
export CPPU_ENV=@CPPU_ENV@ export CPPU_ENV=@CPPU_ENV@
export CPPU_ENV_FOR_BUILD=@CPPU_ENV_FOR_BUILD@ export CPPU_ENV_FOR_BUILD=@CPPU_ENV_FOR_BUILD@
export COLAMD_CFLAGS=$(gb_SPACE)@COLAMD_CFLAGS@
export COLAMD_LIBS=$(gb_SPACE)@COLAMD_LIBS@
export CPPUNIT_CFLAGS=$(gb_SPACE)@CPPUNIT_CFLAGS@ export CPPUNIT_CFLAGS=$(gb_SPACE)@CPPUNIT_CFLAGS@
export CPPUNIT_LIBS=$(gb_SPACE)@CPPUNIT_LIBS@ export CPPUNIT_LIBS=$(gb_SPACE)@CPPUNIT_LIBS@
export CPUNAME=@CPUNAME@ export CPUNAME=@CPUNAME@
@@ -210,7 +208,6 @@ export ENABLE_HTMLHELP=@ENABLE_HTMLHELP@
export ENABLE_JAVA=@ENABLE_JAVA@ export ENABLE_JAVA=@ENABLE_JAVA@
export ENABLE_JUMBO_SHEETS=@ENABLE_JUMBO_SHEETS@ export ENABLE_JUMBO_SHEETS=@ENABLE_JUMBO_SHEETS@
export ENABLE_LDAP=@ENABLE_LDAP@ export ENABLE_LDAP=@ENABLE_LDAP@
export ENABLE_LPSOLVE=@ENABLE_LPSOLVE@
export ENABLE_LTO=@ENABLE_LTO@ export ENABLE_LTO=@ENABLE_LTO@
export ENABLE_LWP=@ENABLE_LWP@ export ENABLE_LWP=@ENABLE_LWP@
export ENABLE_MACOSX_SANDBOX=@ENABLE_MACOSX_SANDBOX@ export ENABLE_MACOSX_SANDBOX=@ENABLE_MACOSX_SANDBOX@
@@ -669,7 +666,6 @@ SYSTEM_BOX2D=@SYSTEM_BOX2D@
SYSTEM_BZIP2=@SYSTEM_BZIP2@ SYSTEM_BZIP2=@SYSTEM_BZIP2@
SYSTEM_CAIRO=@SYSTEM_CAIRO@ SYSTEM_CAIRO=@SYSTEM_CAIRO@
SYSTEM_CLUCENE=@SYSTEM_CLUCENE@ SYSTEM_CLUCENE=@SYSTEM_CLUCENE@
SYSTEM_COLAMD=@SYSTEM_COLAMD@
SYSTEM_CPPUNIT=@SYSTEM_CPPUNIT@ SYSTEM_CPPUNIT=@SYSTEM_CPPUNIT@
SYSTEM_CURL=@SYSTEM_CURL@ SYSTEM_CURL=@SYSTEM_CURL@
SYSTEM_DICTS=@SYSTEM_DICTS@ SYSTEM_DICTS=@SYSTEM_DICTS@
@@ -716,7 +712,6 @@ SYSTEM_LIBXML=@SYSTEM_LIBXML@
SYSTEM_LIBXML_FOR_BUILD=@SYSTEM_LIBXML_FOR_BUILD@ SYSTEM_LIBXML_FOR_BUILD=@SYSTEM_LIBXML_FOR_BUILD@
SYSTEM_LIBXSLT=@SYSTEM_LIBXSLT@ SYSTEM_LIBXSLT=@SYSTEM_LIBXSLT@
SYSTEM_LIBXSLT_FOR_BUILD=@SYSTEM_LIBXSLT_FOR_BUILD@ SYSTEM_LIBXSLT_FOR_BUILD=@SYSTEM_LIBXSLT_FOR_BUILD@
SYSTEM_LPSOLVE=@SYSTEM_LPSOLVE@
SYSTEM_LZMA=@SYSTEM_LZMA@ SYSTEM_LZMA=@SYSTEM_LZMA@
SYSTEM_MD4C=@SYSTEM_MD4C@ SYSTEM_MD4C=@SYSTEM_MD4C@
SYSTEM_MDDS=@SYSTEM_MDDS@ SYSTEM_MDDS=@SYSTEM_MDDS@
-79
View File
@@ -1156,7 +1156,6 @@ ios*) # iOS
enable_lotuswordpro=no enable_lotuswordpro=no
disable_database_connectivity_dependencies disable_database_connectivity_dependencies
enable_coinmp=no enable_coinmp=no
enable_lpsolve=no
enable_extension_integration=no enable_extension_integration=no
enable_xmlhelp=no enable_xmlhelp=no
with_ppds=no with_ppds=no
@@ -1249,7 +1248,6 @@ linux-android*)
enable_mpl_subset=yes enable_mpl_subset=yes
enable_cairo_canvas=no enable_cairo_canvas=no
enable_coinmp=yes enable_coinmp=yes
enable_lpsolve=no
enable_odk=no enable_odk=no
enable_python=no enable_python=no
enable_xmlhelp=no enable_xmlhelp=no
@@ -1674,10 +1672,6 @@ libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
[Enable the Wiki Publisher extension.]) [Enable the Wiki Publisher extension.])
) )
libo_FUZZ_ARG_ENABLE(lpsolve,
AS_HELP_STRING([--disable-lpsolve],
[Disable compilation of the lp solve solver ])
)
libo_FUZZ_ARG_ENABLE(coinmp, libo_FUZZ_ARG_ENABLE(coinmp,
AS_HELP_STRING([--disable-coinmp], AS_HELP_STRING([--disable-coinmp],
[Disable compilation of the CoinMP solver ]) [Disable compilation of the CoinMP solver ])
@@ -2860,16 +2854,6 @@ AC_ARG_WITH(system-altlinuxhyph,
[Use ALTLinuxhyph already on system.]),, [Use ALTLinuxhyph already on system.]),,
[with_system_altlinuxhyph="$with_system_libs"]) [with_system_altlinuxhyph="$with_system_libs"])
AC_ARG_WITH(system-lpsolve,
AS_HELP_STRING([--with-system-lpsolve],
[Use lpsolve already on system.]),,
[with_system_lpsolve="$with_system_libs"])
AC_ARG_WITH(system-colamd,
AS_HELP_STRING([--with-system-colamd],
[Use COLAMD already on system.]),,
[with_system_colamd="$with_system_libs"])
AC_ARG_WITH(system-coinmp, AC_ARG_WITH(system-coinmp,
AS_HELP_STRING([--with-system-coinmp], AS_HELP_STRING([--with-system-coinmp],
[Use CoinMP already on system.]),, [Use CoinMP already on system.]),,
@@ -3470,7 +3454,6 @@ if test "$enable_wasm_strip" = "yes"; then
enable_gpgmepp=no enable_gpgmepp=no
enable_ldap=no enable_ldap=no
enable_lotuswordpro=no enable_lotuswordpro=no
enable_lpsolve=no
enable_nss=no enable_nss=no
enable_odk=no enable_odk=no
enable_online_update=no enable_online_update=no
@@ -12350,64 +12333,6 @@ AC_SUBST(SYSTEM_COINMP)
AC_SUBST(COINMP_CFLAGS) AC_SUBST(COINMP_CFLAGS)
AC_SUBST(COINMP_LIBS) AC_SUBST(COINMP_LIBS)
ENABLE_LPSOLVE=
AC_MSG_CHECKING([whether to build with lpsolve])
if test "$enable_lpsolve" != "no"; then
ENABLE_LPSOLVE=TRUE
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_SUBST(ENABLE_LPSOLVE)
if test "$ENABLE_LPSOLVE" = TRUE; then
AC_MSG_CHECKING([which lpsolve to use])
if test "$with_system_lpsolve" = "yes"; then
AC_MSG_RESULT([external])
SYSTEM_LPSOLVE=TRUE
AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
[ AC_MSG_ERROR(lpsolve headers not found.)], [])
save_LIBS=$LIBS
# some systems need this. Like Ubuntu...
AC_CHECK_LIB(m, floor)
AC_CHECK_LIB(dl, dlopen)
AC_CHECK_LIB([lpsolve55], [make_lp], [:],
[ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
LIBS=$save_LIBS
else
AC_MSG_RESULT([internal])
SYSTEM_LPSOLVE=
BUILD_TYPE="$BUILD_TYPE LPSOLVE"
AC_MSG_CHECKING([which colamd to use])
if test "$with_system_colamd" = "yes"; then
AC_MSG_RESULT([external])
SYSTEM_COLAMD=TRUE
# This assumes suitesparse, which has
# /usr/lib/x86_64-linux-gnu/pkgconfig/COLAMD.pc
PKG_CHECK_MODULES([COLAMD], [COLAMD],
[],
[
# older versions don't. Look in /usr/include/suitesparse
COLAMD_CFLAGS=-I/usr/include/suitesparse
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $COLAMD_CFLAGS"
AC_CHECK_HEADER(colamd.h, [],
[ AC_MSG_ERROR(colamd.h header not found.)], [])
CFLAGS=$save_CFLAGS
AC_CHECK_LIB(colamd, colamd)
COLAMD_LIBS=-lcolamd
])
else
AC_MSG_RESULT([internal])
SYSTEM_COLAMD=
fi
fi
fi
AC_SUBST(SYSTEM_COLAMD)
AC_SUBST(COLAMD_CFLAGS)
AC_SUBST(COLAMD_LIBS)
AC_SUBST(SYSTEM_LPSOLVE)
dnl =================================================================== dnl ===================================================================
dnl Checking for libexttextcat dnl Checking for libexttextcat
dnl =================================================================== dnl ===================================================================
@@ -16077,10 +16002,6 @@ if test "$enable_mpl_subset" = "yes"; then
ENABLE_OPENGL_TRANSITIONS= ENABLE_OPENGL_TRANSITIONS=
if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
mpl_error_string="$mpl_error_string$newline Need to --disable-lpsolve - calc linear programming solver."
fi
if test "x$mpl_error_string" != "x"; then if test "x$mpl_error_string" != "x"; then
AC_MSG_ERROR([$mpl_error_string]) AC_MSG_ERROR([$mpl_error_string])
fi fi
-1
View File
@@ -57,7 +57,6 @@
--without-system-libwpg --without-system-libwpg
--without-system-libwps --without-system-libwps
--without-system-libzmf --without-system-libzmf
--without-system-lpsolve
--without-system-mariadb --without-system-mariadb
--without-system-md4c --without-system-md4c
--without-system-mdds --without-system-mdds
-1
View File
@@ -16,7 +16,6 @@
--disable-ldap --disable-ldap
--disable-libcmis --disable-libcmis
--disable-librelogo --disable-librelogo
--disable-lpsolve
--disable-mariadb-sdbc --disable-mariadb-sdbc
--disable-odk --disable-odk
--disable-poppler --disable-poppler
@@ -1,6 +1,5 @@
--disable-firebird-sdbc --disable-firebird-sdbc
--disable-lotuswordpro --disable-lotuswordpro
--disable-lpsolve
--disable-odk --disable-odk
--disable-online-update --disable-online-update
--disable-pdfimport --disable-pdfimport
-5
View File
@@ -432,11 +432,6 @@ LIBXSLT_TARBALL := libxslt-1.1.$(LIBXSLT_VERSION_MICRO).tar.xz
# three static lines # three static lines
# so that git cherry-pick # so that git cherry-pick
# will not run into conflicts # will not run into conflicts
LPSOLVE_SHA256SUM := 171816288f14215c69e730f7a4f1c325739873e21f946ff83884b350574e6695
LPSOLVE_TARBALL := 26b3e95ddf3d9c077c480ea45874b3b8-lp_solve_5.5.tar.gz
# three static lines
# so that git cherry-pick
# will not run into conflicts
LXML_SHA256SUM := ba96ae44888e0185281e937633a743ea90d5a196c6000f82565ebb0580012d40 LXML_SHA256SUM := ba96ae44888e0185281e937633a743ea90d5a196c6000f82565ebb0580012d40
LXML_TARBALL := lxml-6.1.1.tar.gz LXML_TARBALL := lxml-6.1.1.tar.gz
# three static lines # three static lines
-1
View File
@@ -66,7 +66,6 @@ $(eval $(call gb_Module_add_moduledirs,external,\
$(call gb_Helper_optional,LIBWEBP,libwebp) \ $(call gb_Helper_optional,LIBWEBP,libwebp) \
$(call gb_Helper_optional,LIBXML2,libxml2) \ $(call gb_Helper_optional,LIBXML2,libxml2) \
$(call gb_Helper_optional,LIBXSLT,libxslt) \ $(call gb_Helper_optional,LIBXSLT,libxslt) \
$(call gb_Helper_optional,LPSOLVE,lpsolve) \
$(call gb_Helper_optional,LIBTOMMATH,libtommath) \ $(call gb_Helper_optional,LIBTOMMATH,libtommath) \
$(call gb_Helper_optional,LXML,lxml) \ $(call gb_Helper_optional,LXML,lxml) \
$(call gb_Helper_optional,LZMA,lzma) \ $(call gb_Helper_optional,LZMA,lzma) \
-129
View File
@@ -1,129 +0,0 @@
From 75ba3f247d6f0baa6dc83b7eca09ec67dabe0924 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolan.mcnamara@collabora.com>
Date: Tue, 22 Jul 2025 13:12:12 +0100
Subject: [PATCH] const up some statics
---
lp_params.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/lp_params.c b/lp_params.c
index e8fcd2e..c5de106 100644
--- a/lp_params.c
+++ b/lp_params.c
@@ -53,13 +53,13 @@
REAL_set_function *REAL_set_function; /* set via setREALfunction */
} set_function;
int type; /* set via set*function */
- struct _values *values; /* set via setvalues to a structure of _values */
+ const struct _values *values; /* set via setvalues to a structure of _values */
int elements; /* or via setNULLvalues if the value is shown as is */
unsigned int basemask;
int mask; /* WRITE_ACTIVE or WRITE_COMMENTED */
};
-static struct _values anti_degen[] =
+static const struct _values anti_degen[] =
{
{ setvalue(ANTIDEGEN_NONE) },
{ setvalue(ANTIDEGEN_FIXEDVARS) },
@@ -74,7 +74,7 @@
{ setvalue(ANTIDEGEN_BOUNDFLIP) },
};
-static struct _values basiscrash[] =
+static const struct _values basiscrash[] =
{
{ setvalue(CRASH_NONE) },
/* { setvalue(CRASH_NONBASICBOUNDS) }, */ /* not yet implemented */
@@ -82,14 +82,14 @@
{ setvalue(CRASH_LEASTDEGENERATE) },
};
-static struct _values bb_floorfirst[] =
+static const struct _values bb_floorfirst[] =
{
{ setvalue(BRANCH_CEILING) },
{ setvalue(BRANCH_FLOOR) },
{ setvalue(BRANCH_AUTOMATIC) },
};
-static struct _values bb_rule[] =
+static const struct _values bb_rule[] =
{
{ setvalue(NODE_FIRSTSELECT) },
{ setvalue(NODE_GAPSELECT) },
@@ -114,7 +114,7 @@
{ setvalue(NODE_STRONGINIT) },
};
-static struct _values improve[] =
+static const struct _values improve[] =
{
{ setvalue(IMPROVE_NONE) },
{ setvalue(IMPROVE_SOLUTION) },
@@ -143,7 +143,7 @@
set_mip_gap(lp, FALSE, mip_gap);
}
-static struct _values pivoting[] =
+static const struct _values pivoting[] =
{
{ setvalue(PRICER_FIRSTINDEX) },
{ setvalue(PRICER_DANTZIG) },
@@ -161,7 +161,7 @@
{ setvalue(PRICE_TRUENORMINIT) },
};
-static struct _values presolving[] =
+static const struct _values presolving[] =
{
{ setvalue(PRESOLVE_NONE) },
{ setvalue(PRESOLVE_ROWS) },
@@ -217,14 +217,14 @@
set_presolve(lp, get_presolve(lp), maxloops);
}
-static struct _values print_sol[] =
+static const struct _values print_sol[] =
{
{ FALSE, "0" },
{ TRUE, "1" },
{ setvalue(AUTOMATIC) },
};
-static struct _values scaling[] =
+static const struct _values scaling[] =
{
{ setvalue(SCALE_NONE) },
{ setvalue(SCALE_EXTREME) },
@@ -243,7 +243,7 @@
{ setvalue(SCALE_COLSONLY) },
};
-static struct _values simplextype[] =
+static const struct _values simplextype[] =
{
{ setvalue(SIMPLEX_PRIMAL_PRIMAL) },
{ setvalue(SIMPLEX_DUAL_PRIMAL) },
@@ -251,7 +251,7 @@
{ setvalue(SIMPLEX_DUAL_DUAL) },
};
-static struct _values verbose[] =
+static const struct _values verbose[] =
{
{ setvalue(NEUTRAL) },
{ setvalue(CRITICAL) },
@@ -262,7 +262,7 @@
{ setvalue(FULL) },
};
-static struct _functions functions[] =
+static const struct _functions functions[] =
{
/* solve options */
{ "ANTI_DEGEN", setintfunction(get_anti_degen, set_anti_degen), setvalues(anti_degen, ~0), WRITE_ACTIVE },
--
2.49.0
-24
View File
@@ -1,24 +0,0 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_ExternalPackage_ExternalPackage,lpsolve,lpsolve))
$(eval $(call gb_ExternalPackage_use_external_project,lpsolve,lpsolve))
ifneq ($(DISABLE_DYNLOADING),TRUE)
ifeq ($(OS),WNT)
$(eval $(call gb_ExternalPackage_add_file,lpsolve,$(LIBO_LIB_FOLDER)/lpsolve55.dll,lpsolve55/lpsolve55.dll))
else ifeq ($(OS),MACOSX)
$(eval $(call gb_ExternalPackage_add_file,lpsolve,$(LIBO_LIB_FOLDER)/liblpsolve55.dylib,lpsolve55/liblpsolve55.dylib))
else # $(OS) != WNT/MACOSX
$(eval $(call gb_ExternalPackage_add_file,lpsolve,$(LIBO_LIB_FOLDER)/liblpsolve55.so,lpsolve55/liblpsolve55.so))
endif # $(OS)
endif # $(DISABLE_DYNLOADING)
# vim: set noet sw=4 ts=4:
-37
View File
@@ -1,37 +0,0 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_ExternalProject_ExternalProject,lpsolve))
$(eval $(call gb_ExternalProject_register_targets,lpsolve,\
build \
))
ifeq ($(OS),WNT)
$(call gb_ExternalProject_get_state_target,lpsolve,build):
$(call gb_Trace_StartRange,lpsolve,EXTERNAL)
$(call gb_ExternalProject_run,build,\
LIB="$(ILIB)" RUNTIME_FLAG="$(if $(MSVC_USE_DEBUG_RUNTIME),/MDd,/MD)" \
cmd /c cvc6.bat \
,lpsolve55)
$(call gb_Trace_EndRange,lpsolve,EXTERNAL)
else # $(OS)!=WNT
$(call gb_ExternalProject_get_state_target,lpsolve,build):
$(call gb_Trace_StartRange,lpsolve,EXTERNAL)
$(call gb_ExternalProject_run,build,\
CC="$(CC) $(call gb_ExternalProject_get_build_flags,lpsolve)" \
SYSTEM_COLAMD=$(SYSTEM_COLAMD) \
$(if $(filter MACOSX,$(OS)),EXTRA_LINKFLAGS='-install_name @__________________________________________________OOO/liblpsolve55.dylib') \
sh -e $(if $(filter MACOSX,$(OS)),ccc.osx, \
$(if $(filter TRUE,$(DISABLE_DYNLOADING)),ccc.static, \
ccc)) \
,lpsolve55)
$(call gb_Trace_EndRange,lpsolve,EXTERNAL)
endif # $(OS)
# vim: set noet sw=4 ts=4:
-7
View File
@@ -1,7 +0,0 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
include $(module_directory)/../../solenv/gbuild/partial_build.mk
# vim: set noet sw=4 ts=4:
-18
View File
@@ -1,18 +0,0 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_Module_Module,lpsolve))
$(eval $(call gb_Module_add_targets,lpsolve,\
UnpackedTarball_lpsolve \
ExternalPackage_lpsolve \
ExternalProject_lpsolve \
))
# vim: set noet sw=4 ts=4:
-1
View File
@@ -1 +0,0 @@
A mixed Integer Linear Programming (MILP) solver from [https://github.com/lp-solve/lp_solve].
-44
View File
@@ -1,44 +0,0 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_UnpackedTarball_UnpackedTarball,lpsolve))
$(eval $(call gb_UnpackedTarball_set_tarball,lpsolve,$(LPSOLVE_TARBALL)))
$(eval $(call gb_UnpackedTarball_set_patchlevel,lpsolve,3))
# external/lpsolve/0001-const-up-some-statics.patch.1
# upstreaming attempt as:
# https://github.com/lp-solve/lp_solve/pull/1
$(eval $(call gb_UnpackedTarball_add_patches,lpsolve,\
external/lpsolve/0001-const-up-some-statics.patch.1 \
))
ifeq ($(OS_FOR_BUILD),WNT)
$(eval $(call gb_UnpackedTarball_set_patchflags,lpsolve,--binary))
$(eval $(call gb_UnpackedTarball_add_patches,lpsolve,\
external/lpsolve/lp_solve_5.5-windows.patch \
))
else
$(eval $(call gb_UnpackedTarball_add_patches,lpsolve,\
external/lpsolve/lp_solve_5.5.patch \
external/lpsolve/lpsolve-ubsan.patch.0 \
external/lpsolve/system-colamd.diff \
))
$(eval $(call gb_UnpackedTarball_add_file,lpsolve,lpsolve55/ccc.static,external/lpsolve/ccc.static))
endif
# vim: set noet sw=4 ts=4:
-20
View File
@@ -1,20 +0,0 @@
if [ "$SYSTEM_COLAMD" != "TRUE" ]; then
colamd_c=../colamd/colamd.c
fi
src='../lp_MDO.c ../shared/commonlib.c ../shared/mmio.c ../shared/myblas.c ../ini.c ../fortify.c $colamd_c ../lp_rlp.c ../lp_crash.c ../bfp/bfp_LUSOL/lp_LUSOL.c ../bfp/bfp_LUSOL/LUSOL/lusol.c ../lp_Hash.c ../lp_lib.c ../lp_wlp.c ../lp_matrix.c ../lp_mipbb.c ../lp_MPS.c ../lp_params.c ../lp_presolve.c ../lp_price.c ../lp_pricePSE.c ../lp_report.c ../lp_scale.c ../lp_simplex.c ../lp_SOS.c ../lp_utils.c ../yacc_read.c'
obj=`echo $src|sed -e 's/\.c/.o/g' -e 's!\([^ ]*/\)*!!g'`
opts='-O3'
def=
# FIMXE: Link statically with colamd?
if test "$SYSTEM_COLAMD" = "TRUE"; then
colamd_i=$COLAMD_CFLAGS
else
colamd_i=-I../colamd
fi
$CC -I.. -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL $colamd_i -I../shared $opts $def -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine -c $src
$AR -r liblpsolve55.a $obj
rm $obj
-60
View File
@@ -1,60 +0,0 @@
*** misc/lp_solve_5.5/lpsolve55/cgcc.bat Sun Jun 12 04:27:28 2005
--- misc/build/lp_solve_5.5/lpsolve55/cgcc.bat Sun Dec 14 07:55:19 2008
***************
*** 7,14 ****
set c=gcc
! rem rc lpsolve.rc
! %c% -DINLINE=static -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -s -O3 -shared -mno-cygwin -enable-stdcall-fixup -D_USRDLL -DWIN32 -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine %src% ..\lp_solve.def -o lpsolve55.dll
%c% -DINLINE=static -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -s -O3 -shared -D_USRDLL -DWIN32 -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine %src% -o liblpsolve55.so
--- 7,14 ----
set c=gcc
! windres lpsolve.rc lpsolve_res.obj
! %c% -DINLINE=static -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -s -O3 -shared -mno-cygwin -enable-stdcall-fixup -mthreads %lpsolve_LDFLAGS% -D_USRDLL -DWIN32 -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine %src% lpsolve_res.obj ..\lp_solve.def %lpsolve_LIBS% -o lpsolve55.dll
%c% -DINLINE=static -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -s -O3 -shared -D_USRDLL -DWIN32 -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine %src% -o liblpsolve55.so
*** misc/lp_solve_5.5/lpsolve55/lpsolve.rc Sun Jun 4 00:15:24 2006
--- misc/build/lp_solve_5.5/lpsolve55/lpsolve.rc Fri Nov 23 16:34:22 2007
***************
*** 7,13 ****
//
// Generated from the TEXTINCLUDE 2 resource.
//
! #include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
--- 7,13 ----
//
// Generated from the TEXTINCLUDE 2 resource.
//
! #include "winresrc.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
--- misc/lp_solve_5.5/lpsolve55/cvc6.bat
+++ misc/build/lp_solve_5.5/lpsolve55/cvc6.bat
@@ -14,15 +14,4 @@
set c=cl
-rc lpsolve.rc
+rc %SOLARINC% lpsolve.rc
-%c% -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd /LD /MD /O1 /Zp8 /Gz -D_WINDLL -D_USRDLL -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine %src% lpsolve.res ..\lp_solve.def -o lpsolve55.dll
+%c% -Zi -FS -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd %SOLARINC% /LD %RUNTIME_FLAG% /O1 /Zp8 /Gz -D_WINDLL -D_USRDLL -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine %src% lpsolve.res ..\lp_solve.def -Felpsolve55.dll
-rem /link /LINK50COMPAT
-
-if exist a.obj del a.obj
-%c% -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd /MT /O1 /Zp8 /Gd /c -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine %src%
-lib *.obj /OUT:liblpsolve55.lib
-
-if exist a.obj del a.obj
-%c% -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd /MTd /O1 /Zp8 /Gd /c -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine %src%
-lib *.obj /OUT:liblpsolve55d.lib
-
-if exist *.obj del *.obj
-95
View File
@@ -1,95 +0,0 @@
--- misc/build/lp_solve_5.5/lpsolve55/ccc.orig Sat Jun 11 21:27:18 2005
+++ misc/build/lp_solve_5.5/lpsolve55/ccc Sun May 22 11:20:19 2011
@@ -1,25 +1,42 @@
src='../lp_MDO.c ../shared/commonlib.c ../shared/mmio.c ../shared/myblas.c ../ini.c ../fortify.c ../colamd/colamd.c ../lp_rlp.c ../lp_crash.c ../bfp/bfp_LUSOL/lp_LUSOL.c ../bfp/bfp_LUSOL/LUSOL/lusol.c ../lp_Hash.c ../lp_lib.c ../lp_wlp.c ../lp_matrix.c ../lp_mipbb.c ../lp_MPS.c ../lp_params.c ../lp_presolve.c ../lp_price.c ../lp_pricePSE.c ../lp_report.c ../lp_scale.c ../lp_simplex.c ../lp_SOS.c ../lp_utils.c ../yacc_read.c'
-c=cc
+ar=$AR
+c=$CC
+ranlib=$RANLIB
def=
so=
-if [ "$PLATFORM" = "SCO_UNIX" ]
-then def='-dy -K PIC -DNOLONGLONG'
- dl=-lc
-else dl=-ldl
- so=y
+soprefix=
+libs=
+pic=
+ldflags=
+inline=
+if [ "$OS" = "WNT" -a "$COM" = "GCC" ]; then
+ so=dll
+ a=dll.a
+ inline=-DINLINE=static
+else
+ so=so
+ a=a
+ soprefix=lib
+ libs="-lm"
+ pic=-fpic
+ ldflags="-Wl,-Bsymbolic -Wl,-soname,liblpsolve55.$so"
fi
+if [ "$OS" = "LINUX" ]; then
+ libs="$libs -ldl"
+fi
+
opts='-O3'
-$c -s -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd $opts $def -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
+$c -s $inline -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd $opts $def -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
-ar rv liblpsolve55.a `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'`
-ranlib liblpsolve55.a
+$ar rv liblpsolve55.$a `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'`
+$ranlib liblpsolve55.$a
if [ "$so" != "" ]
then
- $c -fpic -s -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -I. $opts -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
- $c -shared -Wl,-Bsymbolic -Wl,-soname,liblpsolve55.so -o liblpsolve55.so `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'` -lc -lm -ldl
+ $c $pic -s $inline -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -I. $opts -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
+ $c -shared $ldflags -o ${soprefix}lpsolve55.$so `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'` $libs
fi
rm *.o 2>/dev/null
--- misc/build/lp_solve_5.5/lpsolve55/ccc.osx.orig Thu Jun 23 22:53:08 2005
+++ misc/build/lp_solve_5.5/lpsolve55/ccc.osx
@@ -1,23 +1,30 @@
src='../lp_MDO.c ../shared/commonlib.c ../shared/mmio.c ../shared/myblas.c ../ini.c ../fortify.c ../colamd/colamd.c ../lp_rlp.c ../lp_crash.c ../bfp/bfp_LUSOL/lp_LUSOL.c ../bfp/bfp_LUSOL/LUSOL/lusol.c ../lp_Hash.c ../lp_lib.c ../lp_wlp.c ../lp_matrix.c ../lp_mipbb.c ../lp_MPS.c ../lp_params.c ../lp_presolve.c ../lp_price.c ../lp_pricePSE.c ../lp_report.c ../lp_scale.c ../lp_simplex.c ../lp_SOS.c ../lp_utils.c ../yacc_read.c'
-c=cc
+c=$CC
+if test -n "$verbose"; then
+ set -x
+fi
+
def=
so=
+# EXTRA_LINKFLAGS is set in the ExternalProject_lpsolve.mk
+extra_linkflags=$EXTRA_LINKFLAGS
+
if [ "$PLATFORM" = "SCO_UNIX" ]
then def='-DLoadInverseLib=0 -DLoadLanguageLib=0 -D__HYPER=long'
else dl=-ldl
so=y
fi
-opts='-idirafter /usr/include/sys -O3 -DINTEGERTIME -Wno-long-double'
+opts='-idirafter /usr/include/sys -O3 -DINTEGERTIME'
-$c -s -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd $opts $def -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
+$c -s -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd $opts $def -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
-libtool -static -o liblpsolve55.a `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'`
+$LIBTOOL -static -o liblpsolve55.a `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'`
if [ "$so" != "" ]
then
- $c -fPIC -fno-common -s -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -I. $opts -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
- $c -dynamiclib liblpsolve55.a -compatibility_version 5.5.0 -current_version 5.5.0 -o liblpsolve55.dylib `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'` -lc
+ $c -fPIC -fno-common -s -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -I. $opts -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
+ $c $extra_linkflags -dynamiclib liblpsolve55.a -compatibility_version 5.5.0 -current_version 5.5.0 -o liblpsolve55.dylib `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'` -lc
fi
rm *.o 2>/dev/null
-22
View File
@@ -1,22 +0,0 @@
--- lp_presolve.c
+++ lp_presolve.c
@@ -168,7 +168,7 @@
if(isprimal) {
if(psdata->primalundo != NULL)
mat = psdata->primalundo->tracker;
- solution = lp->full_solution + lp->presolve_undo->orig_rows;
+ solution = lp->full_solution == NULL ? NULL : lp->full_solution + lp->presolve_undo->orig_rows;
slacks = lp->full_solution;
}
else {
--- lp_pricePSE.c
+++ lp_pricePSE.c
@@ -145,7 +147,7 @@
/* Store the active/current pricing type */
if(isdual == AUTOMATIC)
- isdual = (MYBOOL) lp->edgeVector[0];
+ isdual = lp->edgeVector[0] != 0.0;
else
lp->edgeVector[0] = isdual;
-39
View File
@@ -1,39 +0,0 @@
diff -urN lp_solve_5.5-old/lpsolve55/ccc lp_solve_5.5/lpsolve55/ccc
--- misc/build/lp_solve_5.5/lpsolve55/ccc 2005-06-11 21:27:18.000000000 +0200
+++ misc/build/lp_solve_5.5/lpsolve55/ccc 2025-03-02 17:58:19.904235635 +0100
@@ -1,4 +1,7 @@
-src='../lp_MDO.c ../shared/commonlib.c ../shared/mmio.c ../shared/myblas.c ../ini.c ../fortify.c ../colamd/colamd.c ../lp_rlp.c ../lp_crash.c ../bfp/bfp_LUSOL/lp_LUSOL.c ../bfp/bfp_LUSOL/LUSOL/lusol.c ../lp_Hash.c ../lp_lib.c ../lp_wlp.c ../lp_matrix.c ../lp_mipbb.c ../lp_MPS.c ../lp_params.c ../lp_presolve.c ../lp_price.c ../lp_pricePSE.c ../lp_report.c ../lp_scale.c ../lp_simplex.c ../lp_SOS.c ../lp_utils.c ../yacc_read.c'
+if test "$SYSTEM_COLAMD" != "TRUE"; then
+ colamd_c=../colamd/colamd.c
+fi
+src="../lp_MDO.c ../shared/commonlib.c ../shared/mmio.c ../shared/myblas.c ../ini.c ../fortify.c $colamd_c ../lp_rlp.c ../lp_crash.c ../bfp/bfp_LUSOL/lp_LUSOL.c ../bfp/bfp_LUSOL/LUSOL/lusol.c ../lp_Hash.c ../lp_lib.c ../lp_wlp.c ../lp_matrix.c ../lp_mipbb.c ../lp_MPS.c ../lp_params.c ../lp_presolve.c ../lp_price.c ../lp_pricePSE.c ../lp_report.c ../lp_scale.c ../lp_simplex.c ../lp_SOS.c ../lp_utils.c ../yacc_read.c"
ar=$AR
c=$CC
ranlib=$RANLIB
@@ -25,17 +28,24 @@
if [ "$OS" = "LINUX" ]; then
libs="$libs -ldl"
+ libs="$libs $COLAMD_LIBS"
fi
opts='-O3'
-$c -s $inline -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd $opts $def -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
+if test "$SYSTEM_COLAMD" = "TRUE"; then
+ colamd_i=$COLAMD_CFLAGS
+else
+ colamd_i=-I../colamd
+fi
+
+$c -s $inline -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL $colamd_i $opts $def -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
$ar rv liblpsolve55.$a `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'`
$ranlib liblpsolve55.$a
if [ "$so" != "" ]
then
- $c $pic -s $inline -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL -I../colamd -I. $opts -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
+ $c $pic -s $inline -c -I.. -I../shared -I../bfp -I../bfp/bfp_LUSOL -I../bfp/bfp_LUSOL/LUSOL $colamd_i -I. $opts -DYY_NEVER_INTERACTIVE -DPARSER_LP -DINVERSE_ACTIVE=INVERSE_LUSOL -DRoleIsExternalInvEngine $src
$c -shared $ldflags -o ${soprefix}lpsolve55.$so `echo $src|sed s/[.]c/.o/g|sed 's/[^ ]*\///g'` $libs
fi
-6
View File
@@ -1483,12 +1483,6 @@
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.</p> OTHER DEALINGS IN THE SOFTWARE.</p>
</div> </div>
<div class="LPSOLVE" >
<h2>lpsolve</h2>
<p>The following software may be included in this product: lpsolve. Use of any of this software is governed by
the terms of the license below:</p>
<p><a href="#a__LGPL_version_2_1">Jump to LGPL Version 2.1</a></p>
</div>
<div class="LZMA"> <div class="LZMA">
<h2>lzma</h2> <h2>lzma</h2>
<p>liblzma is under the BSD Zero Clause License (0BSD)</p> <p>liblzma is under the BSD Zero Clause License (0BSD)</p>
+1 -1
View File
@@ -315,7 +315,7 @@ $(eval $(call gb_Module_add_uicheck_targets,sc,\
UITest_sc_styleui \ UITest_sc_styleui \
)) ))
ifneq ($(or $(ENABLE_LPSOLVE),$(ENABLE_COINMP)),) ifneq ($(ENABLE_COINMP),)
$(eval $(call gb_Module_add_uicheck_targets,sc,\ $(eval $(call gb_Module_add_uicheck_targets,sc,\
UITest_solver \ UITest_solver \
)) ))
+1 -1
View File
@@ -22,7 +22,7 @@ $(eval $(call gb_CppunitTest_use_externals,sc_$(1), \
$(eval $(call gb_Library_use_common_precompiled_header,sc_$(1))) $(eval $(call gb_Library_use_common_precompiled_header,sc_$(1)))
$(eval $(call gb_CppunitTest_add_defs,sc_$(1),\ $(eval $(call gb_CppunitTest_add_defs,sc_$(1),\
$(if $(ENABLE_LPSOLVE), -DENABLE_LPSOLVE) \ $(if $(ENABLE_COINMP), -DENABLE_COINMP) \
)) ))
$(eval $(call gb_CppunitTest_add_exception_objects,sc_$(1), \ $(eval $(call gb_CppunitTest_add_exception_objects,sc_$(1), \
+1 -2
View File
@@ -38,7 +38,7 @@ enum SolverParameter
SP_LO_ENGINE, // Engine name used in LO SP_LO_ENGINE, // Engine name used in LO
SP_MS_ENGINE, // Engine ID used in MSO SP_MS_ENGINE, // Engine ID used in MSO
SP_INTEGER, // Assume all variables are integer (0: no, 1: yes) SP_INTEGER, // Assume all variables are integer (0: no, 1: yes)
// LpSolve, CoinMP and SwarmSolver // CoinMP and SwarmSolver
SP_NON_NEGATIVE, // Assume non negativity (1: yes, 2: no) SP_NON_NEGATIVE, // Assume non negativity (1: yes, 2: no)
SP_EPSILON_LEVEL, // Epsilon level SP_EPSILON_LEVEL, // Epsilon level
SP_LIMIT_BBDEPTH, // Branch and bound depth SP_LIMIT_BBDEPTH, // Branch and bound depth
@@ -230,7 +230,6 @@ private:
// Maps LO solver implementation names to MS engine codes // Maps LO solver implementation names to MS engine codes
std::map<OUString, OUString> SolverNamesToExcelEngines = { std::map<OUString, OUString> SolverNamesToExcelEngines = {
{ "com.sun.star.comp.Calc.CoinMPSolver", "2" }, // Simplex LP { "com.sun.star.comp.Calc.CoinMPSolver", "2" }, // Simplex LP
{ "com.sun.star.comp.Calc.LpsolveSolver", "2" }, // Simplex LP
{ "com.sun.star.comp.Calc.SwarmSolver", "1" }, // GRG Nonlinear { "com.sun.star.comp.Calc.SwarmSolver", "1" }, // GRG Nonlinear
{ "com.sun.star.comp.Calc.NLPSolver.DEPSSolverImpl", "3" }, // DEPS { "com.sun.star.comp.Calc.NLPSolver.DEPSSolverImpl", "3" }, // DEPS
{ "com.sun.star.comp.Calc.NLPSolver.SCOSolverImpl", "3" } // SCO { "com.sun.star.comp.Calc.NLPSolver.SCOSolverImpl", "3" } // SCO
+8 -7
View File
@@ -35,7 +35,7 @@ public:
virtual void setUp() override; virtual void setUp() override;
void testXSolverSettings(); void testXSolverSettings();
#ifdef ENABLE_LPSOLVE #ifdef ENABLE_COINMP
void testCellAddress(const table::CellAddress& rExpected, const uno::Any& rActual); void testCellAddress(const table::CellAddress& rExpected, const uno::Any& rActual);
void testCellRangeAddress(const uno::Any& rExpected, const uno::Any& rActual); void testCellRangeAddress(const uno::Any& rExpected, const uno::Any& rActual);
#endif #endif
@@ -50,7 +50,7 @@ ScSolverSettingsObj::ScSolverSettingsObj()
{ {
} }
#ifdef ENABLE_LPSOLVE #ifdef ENABLE_COINMP
void ScSolverSettingsObj::testCellAddress(const table::CellAddress& rExpected, void ScSolverSettingsObj::testCellAddress(const table::CellAddress& rExpected,
const uno::Any& rActual) const uno::Any& rActual)
{ {
@@ -78,7 +78,7 @@ void ScSolverSettingsObj::testCellRangeAddress(const uno::Any& rExpected, const
// Creates a model using the XSolverSettings API checks if it is accessible via the API // Creates a model using the XSolverSettings API checks if it is accessible via the API
void ScSolverSettingsObj::testXSolverSettings() void ScSolverSettingsObj::testXSolverSettings()
{ {
#ifdef ENABLE_LPSOLVE #ifdef ENABLE_COINMP
uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, uno::UNO_QUERY_THROW); uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, uno::UNO_QUERY_THROW);
uno::Reference<container::XIndexAccess> xIndex(xDoc->getSheets(), uno::UNO_QUERY_THROW); uno::Reference<container::XIndexAccess> xIndex(xDoc->getSheets(), uno::UNO_QUERY_THROW);
uno::Reference<sheet::XSpreadsheet> xSheet(xIndex->getByIndex(0), uno::UNO_QUERY_THROW); uno::Reference<sheet::XSpreadsheet> xSheet(xIndex->getByIndex(0), uno::UNO_QUERY_THROW);
@@ -108,7 +108,7 @@ void ScSolverSettingsObj::testXSolverSettings()
xSolverModel->setConstraints(aConstraints); xSolverModel->setConstraints(aConstraints);
// Set solver engine options // Set solver engine options
xSolverModel->setEngine(u"com.sun.star.comp.Calc.LpsolveSolver"_ustr); xSolverModel->setEngine(u"com.sun.star.comp.Calc.CoinMPSolver"_ustr);
uno::Sequence<beans::PropertyValue> aEngineOptions{ uno::Sequence<beans::PropertyValue> aEngineOptions{
comphelper::makePropertyValue(u"Timeout"_ustr, uno::Any(static_cast<sal_Int32>(10))), comphelper::makePropertyValue(u"Timeout"_ustr, uno::Any(static_cast<sal_Int32>(10))),
comphelper::makePropertyValue(u"NonNegative"_ustr, true), comphelper::makePropertyValue(u"NonNegative"_ustr, true),
@@ -120,8 +120,9 @@ void ScSolverSettingsObj::testXSolverSettings()
xSolverModel->setSuppressDialog(true); xSolverModel->setSuppressDialog(true);
xSolverModel->solve(); xSolverModel->solve();
// The correct solution value is 6981 (using LpsolveSolver) // The optimal total value for this knapsack is 6987, which fills the weight
CPPUNIT_ASSERT_EQUAL(static_cast<double>(6981), xSheet->getCellByPosition(6, 6)->getValue()); // capacity of 1000 exactly.
CPPUNIT_ASSERT_EQUAL(static_cast<double>(6987), xSheet->getCellByPosition(6, 6)->getValue());
// Check objective function and variable cells // Check objective function and variable cells
testCellAddress(aObjCell, xSolverModel->getObjectiveCell()); testCellAddress(aObjCell, xSolverModel->getObjectiveCell());
@@ -147,7 +148,7 @@ void ScSolverSettingsObj::testXSolverSettings()
testCellRangeAddress(uno::Any(aRight2), aSeqConstr[1].Right); testCellRangeAddress(uno::Any(aRight2), aSeqConstr[1].Right);
// Check solver engine options // Check solver engine options
CPPUNIT_ASSERT_EQUAL(u"com.sun.star.comp.Calc.LpsolveSolver"_ustr, xSolverModel->getEngine()); CPPUNIT_ASSERT_EQUAL(u"com.sun.star.comp.Calc.CoinMPSolver"_ustr, xSolverModel->getEngine());
// Check solver engine options // Check solver engine options
uno::Sequence<beans::PropertyValue> aEngProps = xSolverModel->getEngineOptions(); uno::Sequence<beans::PropertyValue> aEngProps = xSolverModel->getEngineOptions();
+5
View File
@@ -438,6 +438,11 @@ void SolverSettings::ReadEngine()
m_sLOEngineName = "com.sun.star.comp.Calc.CoinMPSolver"; m_sLOEngineName = "com.sun.star.comp.Calc.CoinMPSolver";
} }
// The Lpsolve solver has been removed. A document that still names it is
// solved by CoinMP, which handles the same linear models.
if (m_sLOEngineName == "com.sun.star.comp.Calc.LpsolveSolver")
m_sLOEngineName = u"com.sun.star.comp.Calc.CoinMPSolver"_ustr;
if (SolverNamesToExcelEngines.count(m_sLOEngineName)) if (SolverNamesToExcelEngines.count(m_sLOEngineName))
{ {
// Find equivalent MS engine code // Find equivalent MS engine code
-1
View File
@@ -15,7 +15,6 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sccomp_solver,\
$(eval $(call gb_CppunitTest_add_defs,sccomp_solver,\ $(eval $(call gb_CppunitTest_add_defs,sccomp_solver,\
$(if $(ENABLE_COINMP), -DENABLE_COINMP) \ $(if $(ENABLE_COINMP), -DENABLE_COINMP) \
$(if $(ENABLE_LPSOLVE), -DENABLE_LPSOLVE) \
)) ))
$(eval $(call gb_CppunitTest_use_libraries,sccomp_solver,\ $(eval $(call gb_CppunitTest_use_libraries,sccomp_solver,\
-3
View File
@@ -23,7 +23,6 @@ $(eval $(call gb_Library_set_componentfile,solver,sccomp/source/solver/solver,se
$(eval $(call gb_Library_add_componentimpls,solver, \ $(eval $(call gb_Library_add_componentimpls,solver, \
$(if $(ENABLE_COINMP),coinmp) \ $(if $(ENABLE_COINMP),coinmp) \
$(if $(ENABLE_LPSOLVE),lpsolve) \
)) ))
$(eval $(call gb_Library_use_sdk_api,solver)) $(eval $(call gb_Library_use_sdk_api,solver))
@@ -44,14 +43,12 @@ $(eval $(call gb_Library_use_libraries,solver,\
$(eval $(call gb_Library_use_externals,solver,\ $(eval $(call gb_Library_use_externals,solver,\
coinmp \ coinmp \
lpsolve \
)) ))
$(eval $(call gb_Library_add_exception_objects,solver,\ $(eval $(call gb_Library_add_exception_objects,solver,\
sccomp/source/solver/SwarmSolver \ sccomp/source/solver/SwarmSolver \
sccomp/source/solver/SolverComponent \ sccomp/source/solver/SolverComponent \
$(if $(ENABLE_COINMP), sccomp/source/solver/CoinMPSolver) \ $(if $(ENABLE_COINMP), sccomp/source/solver/CoinMPSolver) \
$(if $(ENABLE_LPSOLVE), sccomp/source/solver/LpsolveSolver) \
)) ))
# vim: set noet sw=4 ts=4: # vim: set noet sw=4 ts=4:
+1 -17
View File
@@ -22,14 +22,8 @@ class LpSolverTest: public test::BootstrapFixture
{ {
uno::Reference<sheet::XSpreadsheetDocument> m_xDocument; uno::Reference<sheet::XSpreadsheetDocument> m_xDocument;
#ifdef ENABLE_LPSOLVE
void testLpSolver();
#endif
#ifdef ENABLE_COINMP #ifdef ENABLE_COINMP
void testCoinMPSolver(); void testCoinMPSolver();
#endif
#if defined(ENABLE_LPSOLVE) || defined(ENABLE_COINMP)
void testSolver(OUString const & rName); void testSolver(OUString const & rName);
#endif #endif
@@ -38,9 +32,6 @@ public:
virtual void tearDown() override; virtual void tearDown() override;
CPPUNIT_TEST_SUITE(LpSolverTest); CPPUNIT_TEST_SUITE(LpSolverTest);
#ifdef ENABLE_LPSOLVE
CPPUNIT_TEST(testLpSolver);
#endif
#ifdef ENABLE_COINMP #ifdef ENABLE_COINMP
CPPUNIT_TEST(testCoinMPSolver); CPPUNIT_TEST(testCoinMPSolver);
#endif #endif
@@ -64,13 +55,6 @@ void LpSolverTest::tearDown()
test::BootstrapFixture::tearDown(); test::BootstrapFixture::tearDown();
} }
#ifdef ENABLE_LPSOLVE
void LpSolverTest::testLpSolver()
{
testSolver(u"com.sun.star.comp.Calc.LpsolveSolver"_ustr);
}
#endif
#ifdef ENABLE_COINMP #ifdef ENABLE_COINMP
void LpSolverTest::testCoinMPSolver() void LpSolverTest::testCoinMPSolver()
{ {
@@ -78,7 +62,7 @@ void LpSolverTest::testCoinMPSolver()
} }
#endif #endif
#if defined(ENABLE_LPSOLVE) || defined(ENABLE_COINMP) #ifdef ENABLE_COINMP
void LpSolverTest::testSolver(OUString const & rName) void LpSolverTest::testSolver(OUString const & rName)
{ {
uno::Reference<sheet::XSolver> xSolver(m_xContext->getServiceManager()-> uno::Reference<sheet::XSolver> xSolver(m_xContext->getServiceManager()->
-452
View File
@@ -1,452 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org 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 Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*
************************************************************************/
#include <sal/config.h>
#include <sal/log.hxx>
#undef LANGUAGE_NONE
#if defined _WIN32
#define WINAPI __stdcall
#endif
#define LoadInverseLib FALSE
#define LoadLanguageLib FALSE
#ifdef SYSTEM_LPSOLVE
#include <lpsolve/lp_lib.h>
#else
#include <lp_lib.h>
#endif
#undef LANGUAGE_NONE
#include "SolverComponent.hxx"
#include <strings.hrc>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/table/CellAddress.hpp>
#include <rtl/math.hxx>
#include <algorithm>
#include <memory>
#include <vector>
namespace com::sun::star::uno { class XComponentContext; }
using namespace com::sun::star;
namespace {
class LpsolveSolver : public SolverComponent
{
public:
LpsolveSolver() {}
private:
virtual void SAL_CALL solve() override;
virtual OUString SAL_CALL getImplementationName() override
{
return u"com.sun.star.comp.Calc.LpsolveSolver"_ustr;
}
virtual OUString SAL_CALL getComponentDescription() override
{
return SolverComponent::GetResourceString( RID_SOLVER_COMPONENT );
}
};
}
void SAL_CALL LpsolveSolver::solve()
{
uno::Reference<frame::XModel> xModel( mxDoc, uno::UNO_QUERY_THROW );
maStatus.clear();
mbSuccess = false;
if ( mnEpsilonLevel < EPS_TIGHT || mnEpsilonLevel > EPS_BAGGY )
{
maStatus = SolverComponent::GetResourceString( RID_ERROR_EPSILONLEVEL );
return;
}
xModel->lockControllers();
// collect variables in vector (?)
const auto & aVariableCells = maVariables;
size_t nVariables = aVariableCells.size();
size_t nVar = 0;
// Store all RHS values
sal_uInt32 nConstraints = maConstraints.size();
m_aConstrRHS.realloc(nConstraints);
// collect all dependent cells
ScSolverCellHashMap aCellsHash;
aCellsHash[maObjective].reserve( nVariables + 1 ); // objective function
for (const auto& rConstr : maConstraints)
{
table::CellAddress aCellAddr = rConstr.Left;
aCellsHash[aCellAddr].reserve( nVariables + 1 ); // constraints: left hand side
if ( rConstr.Right >>= aCellAddr )
aCellsHash[aCellAddr].reserve( nVariables + 1 ); // constraints: right hand side
}
// set all variables to zero
//! store old values?
//! use old values as initial values?
for ( const auto& rVarCell : aVariableCells )
{
SolverComponent::SetValue( mxDoc, rVarCell, 0.0 );
}
// read initial values from all dependent cells
for ( auto& rEntry : aCellsHash )
{
double fValue = SolverComponent::GetValue( mxDoc, rEntry.first );
rEntry.second.push_back( fValue ); // store as first element, as-is
}
// loop through variables
for ( const auto& rVarCell : aVariableCells )
{
SolverComponent::SetValue( mxDoc, rVarCell, 1.0 ); // set to 1 to examine influence
// read value change from all dependent cells
for ( auto& rEntry : aCellsHash )
{
double fChanged = SolverComponent::GetValue( mxDoc, rEntry.first );
double fInitial = rEntry.second.front();
rEntry.second.push_back( fChanged - fInitial );
}
SolverComponent::SetValue( mxDoc, rVarCell, 2.0 ); // minimal test for linearity
for ( const auto& rEntry : aCellsHash )
{
double fInitial = rEntry.second.front();
double fCoeff = rEntry.second.back(); // last appended: coefficient for this variable
double fTwo = SolverComponent::GetValue( mxDoc, rEntry.first );
bool bLinear = rtl::math::approxEqual( fTwo, fInitial + 2.0 * fCoeff ) ||
rtl::math::approxEqual( fInitial, fTwo - 2.0 * fCoeff );
// second comparison is needed in case fTwo is zero
if ( !bLinear )
maStatus = SolverComponent::GetResourceString( RID_ERROR_NONLINEAR );
}
SolverComponent::SetValue( mxDoc, rVarCell, 0.0 ); // set back to zero for examining next variable
}
xModel->unlockControllers();
if ( !maStatus.isEmpty() )
return;
// build lp_solve model
lprec* lp = make_lp( 0, nVariables );
if ( !lp )
return;
set_outputfile( lp, const_cast<char*>( "" ) ); // no output
// set objective function
const std::vector<double>& rObjCoeff = aCellsHash[maObjective];
std::unique_ptr<REAL[]> pObjVal(new REAL[nVariables+1]);
pObjVal[0] = 0.0; // ignored
for (nVar=0; nVar<nVariables; nVar++)
pObjVal[nVar+1] = rObjCoeff[nVar+1];
set_obj_fn( lp, pObjVal.get() );
pObjVal.reset();
set_rh( lp, 0, rObjCoeff[0] ); // constant term of objective
// add rows
set_add_rowmode(lp, TRUE);
sal_uInt32 nConstrCount(0);
double* pConstrRHS = m_aConstrRHS.getArray();
for (const auto& rConstr : maConstraints)
{
// integer constraints are set later
sheet::SolverConstraintOperator eOp = rConstr.Operator;
if ( eOp == sheet::SolverConstraintOperator_LESS_EQUAL ||
eOp == sheet::SolverConstraintOperator_GREATER_EQUAL ||
eOp == sheet::SolverConstraintOperator_EQUAL )
{
double fDirectValue = 0.0;
bool bRightCell = false;
table::CellAddress aRightAddr;
const uno::Any& rRightAny = rConstr.Right;
if ( rRightAny >>= aRightAddr )
bRightCell = true; // cell specified as right-hand side
else
rRightAny >>= fDirectValue; // constant value
table::CellAddress aLeftAddr = rConstr.Left;
const std::vector<double>& rLeftCoeff = aCellsHash[aLeftAddr];
std::unique_ptr<REAL[]> pValues(new REAL[nVariables+1] );
pValues[0] = 0.0; // ignored?
for (nVar=0; nVar<nVariables; nVar++)
pValues[nVar+1] = rLeftCoeff[nVar+1];
// if left hand cell has a constant term, put into rhs value
double fRightValue = -rLeftCoeff[0];
if ( bRightCell )
{
const std::vector<double>& rRightCoeff = aCellsHash[aRightAddr];
// modify pValues with rhs coefficients
for (nVar=0; nVar<nVariables; nVar++)
pValues[nVar+1] -= rRightCoeff[nVar+1];
fRightValue += rRightCoeff[0]; // constant term
}
else
fRightValue += fDirectValue;
// Remember the RHS value used for sensitivity analysis later
pConstrRHS[nConstrCount] = fRightValue;
int nConstrType = LE;
switch ( eOp )
{
case sheet::SolverConstraintOperator_LESS_EQUAL: nConstrType = LE; break;
case sheet::SolverConstraintOperator_GREATER_EQUAL: nConstrType = GE; break;
case sheet::SolverConstraintOperator_EQUAL: nConstrType = EQ; break;
default:
OSL_FAIL( "unexpected enum type" );
}
add_constraint( lp, pValues.get(), nConstrType, fRightValue );
nConstrCount++;
}
}
set_add_rowmode(lp, FALSE);
// apply settings to all variables
for (nVar=0; nVar<nVariables; nVar++)
{
if ( !mbNonNegative )
set_unbounded(lp, nVar+1); // allow negative (default is non-negative)
//! collect bounds from constraints?
if ( mbInteger )
set_int(lp, nVar+1, TRUE);
}
// apply single-var integer constraints
for (const auto& rConstr : maConstraints)
{
sheet::SolverConstraintOperator eOp = rConstr.Operator;
if ( eOp == sheet::SolverConstraintOperator_INTEGER ||
eOp == sheet::SolverConstraintOperator_BINARY )
{
table::CellAddress aLeftAddr = rConstr.Left;
// find variable index for cell
for (nVar=0; nVar<nVariables; nVar++)
if ( AddressEqual( aVariableCells[nVar], aLeftAddr ) )
{
if ( eOp == sheet::SolverConstraintOperator_INTEGER )
set_int(lp, nVar+1, TRUE);
else
set_binary(lp, nVar+1, TRUE);
}
}
}
if ( mbMaximize )
set_maxim(lp);
else
set_minim(lp);
if ( !mbLimitBBDepth )
set_bb_depthlimit( lp, 0 );
set_epslevel( lp, mnEpsilonLevel );
set_timeout( lp, mnTimeout );
// solve model
int nResult = ::solve( lp );
mbSuccess = ( nResult == OPTIMAL );
if ( mbSuccess )
{
// get solution
maSolution.realloc( nVariables );
REAL* pResultVar = nullptr;
get_ptr_variables( lp, &pResultVar );
std::copy_n(pResultVar, nVariables, maSolution.getArray());
mfResultValue = get_objective( lp );
// Initially set to false because getting the report might fail
m_aSensitivityReport.HasReport = false;
// Get sensitivity report if the user set SensitivityReport parameter to true
if (mbGenSensitivity)
{
// Get sensitivity data about the objective function
// LpSolve returns an interval for the coefficients of the objective function
// instead of returning an allowable increase/decrease (which is what we want to show
// in the sensitivity report; so we these from/till values are converted into increase
// and decrease values later)
REAL* pObjFrom = nullptr;
REAL* pObjTill = nullptr;
bool bHasObjReport = false;
bHasObjReport = get_ptr_sensitivity_obj(lp, &pObjFrom, &pObjTill);
// Get sensitivity data about constraints
// Similarly to the objective function, the sensitivity values returned for the
// constraints are in the form from/till and are later converted to increase and
// decrease values later
REAL* pConstrValue = nullptr;
REAL* pConstrDual = nullptr;
REAL* pConstrFrom = nullptr;
REAL* pConstrTill = nullptr;
bool bHasConstrReport = false;
bHasConstrReport = get_ptr_sensitivity_rhs(lp, &pConstrDual, &pConstrFrom, &pConstrTill);
// When successful, store sensitivity data in the solver component
if (bHasObjReport && bHasConstrReport)
{
m_aSensitivityReport.HasReport = true;
m_aObjDecrease.realloc(nVariables);
m_aObjIncrease.realloc(nVariables);
double* pObjDecrease = m_aObjDecrease.getArray();
double* pObjIncrease = m_aObjIncrease.getArray();
for (size_t i = 0; i < nVariables; i++)
{
// Allowed decrease. Note that the indices of rObjCoeff are offset by 1
// because of the objective function
if (static_cast<bool>(is_infinite(lp, pObjFrom[i])))
pObjDecrease[i] = get_infinite(lp);
else
pObjDecrease[i] = rObjCoeff[i + 1] - pObjFrom[i];
// Allowed increase
if (static_cast<bool>(is_infinite(lp, pObjTill[i])))
pObjIncrease[i] = get_infinite(lp);
else
pObjIncrease[i] = pObjTill[i] - rObjCoeff[i + 1];
}
// Save objective coefficients for the sensitivity report
double* pObjCoefficients(new double[nVariables]);
for (size_t i = 0; i < nVariables; i++)
pObjCoefficients[i] = rObjCoeff[i + 1];
m_aObjCoefficients.realloc(nVariables);
std::copy_n(pObjCoefficients, nVariables, m_aObjCoefficients.getArray());
// The reduced costs are in pConstrDual after the constraints
double* pObjRedCost(new double[nVariables]);
for (size_t i = 0; i < nVariables; i++)
pObjRedCost[i] = pConstrDual[nConstraints + i];
m_aObjRedCost.realloc(nVariables);
std::copy_n(pObjRedCost, nVariables, m_aObjRedCost.getArray());
// Final value of constraints
get_ptr_constraints(lp, &pConstrValue);
m_aConstrValue.realloc(nConstraints);
std::copy_n(pConstrValue, nConstraints, m_aConstrValue.getArray());
// The RHS contains information for each constraint
m_aConstrDual.realloc(nConstraints);
m_aConstrDecrease.realloc(nConstraints);
m_aConstrIncrease.realloc(nConstraints);
std::copy_n(pConstrDual, nConstraints, m_aConstrDual.getArray());
double* pConstrDecrease = m_aConstrDecrease.getArray();
double* pConstrIncrease = m_aConstrIncrease.getArray();
for (sal_uInt32 i = 0; i < nConstraints; i++)
{
// Allowed decrease
pConstrDecrease[i] = m_aConstrRHS[i] - pConstrFrom[i];
if (static_cast<bool>(is_infinite(lp, pConstrFrom[i]))
&& maConstraints[i].Operator == sheet::SolverConstraintOperator_LESS_EQUAL)
pConstrDecrease[i] = m_aConstrRHS[i] - m_aConstrValue[i];
// Allowed increase
pConstrIncrease[i] = pConstrTill[i] - m_aConstrRHS[i];
if (static_cast<bool>(is_infinite(lp, pConstrTill[i]))
&& maConstraints[i].Operator == sheet::SolverConstraintOperator_GREATER_EQUAL)
pConstrIncrease[i] = m_aConstrValue[i] - m_aConstrRHS[i];
}
// Set all values of the SensitivityReport object
m_aSensitivityReport.ObjCoefficients = m_aObjCoefficients;
m_aSensitivityReport.ObjReducedCosts = m_aObjRedCost;
m_aSensitivityReport.ObjAllowableDecreases = m_aObjDecrease;
m_aSensitivityReport.ObjAllowableIncreases = m_aObjIncrease;
m_aSensitivityReport.ConstrValues = m_aConstrValue;
m_aSensitivityReport.ConstrRHS = m_aConstrRHS;
m_aSensitivityReport.ConstrShadowPrices = m_aConstrDual;
m_aSensitivityReport.ConstrAllowableDecreases = m_aConstrDecrease;
m_aSensitivityReport.ConstrAllowableIncreases = m_aConstrIncrease;
}
}
}
else if ( nResult == INFEASIBLE )
maStatus = SolverComponent::GetResourceString( RID_ERROR_INFEASIBLE );
else if ( nResult == UNBOUNDED )
maStatus = SolverComponent::GetResourceString( RID_ERROR_UNBOUNDED );
else if ( nResult == TIMEOUT || nResult == SUBOPTIMAL )
maStatus = SolverComponent::GetResourceString( RID_ERROR_TIMEOUT );
// SUBOPTIMAL is assumed to be caused by a timeout, and reported as an error
delete_lp( lp );
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
com_sun_star_comp_Calc_LpsolveSolver_get_implementation(
css::uno::XComponentContext *,
css::uno::Sequence<css::uno::Any> const &)
{
return cppu::acquire(new LpsolveSolver());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-5
View File
@@ -13,11 +13,6 @@
<service name="com.sun.star.sheet.Solver"/> <service name="com.sun.star.sheet.Solver"/>
<optional/> <optional/>
</implementation> </implementation>
<implementation name="com.sun.star.comp.Calc.LpsolveSolver"
constructor="com_sun_star_comp_Calc_LpsolveSolver_get_implementation">
<service name="com.sun.star.sheet.Solver"/>
<optional/>
</implementation>
<implementation name="com.sun.star.comp.Calc.SwarmSolver" <implementation name="com.sun.star.comp.Calc.SwarmSolver"
constructor="com_sun_star_comp_Calc_SwarmSolver_get_implementation"> constructor="com_sun_star_comp_Calc_SwarmSolver_get_implementation">
<service name="com.sun.star.sheet.Solver"/> <service name="com.sun.star.sheet.Solver"/>
@@ -1,7 +0,0 @@
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
com.sun.star.comp.Calc.LpsolveSolver
+1 -1
View File
@@ -18,7 +18,7 @@ $(eval $(call gb_InstallModule_define_if_set,scp2/calc,\
ENABLE_MACOSX_SANDBOX \ ENABLE_MACOSX_SANDBOX \
)) ))
ifneq (,$(ENABLE_COINMP)$(ENABLE_LPSOLVE)) ifneq (,$(ENABLE_COINMP))
$(eval $(call gb_InstallModule_add_defs,scp2/calc,\ $(eval $(call gb_InstallModule_add_defs,scp2/calc,\
-DWITH_LPSOLVER \ -DWITH_LPSOLVER \
)) ))
+1 -2
View File
@@ -36,8 +36,7 @@ Module gid_Module_Prg_Calc_Bin
Default = YES; Default = YES;
Styles = (HIDDEN_ROOT); Styles = (HIDDEN_ROOT);
Files = (auto_calc_ALL, Files = (auto_calc_ALL,
gid_File_Share_Registry_Calc_Xcd, gid_File_Share_Registry_Calc_Xcd);
gid_File_Lib_Lpsolve);
End End
Module gid_Module_Prg_Calc_Addins Module gid_Module_Prg_Calc_Addins
-1
View File
@@ -45,7 +45,6 @@ STAGINGDIR=`mktemp -d`
find lib/*.so* \ find lib/*.so* \
lib/arm-linux-gnueabihf \ lib/arm-linux-gnueabihf \
usr/include \ usr/include \
usr/lib/liblpsolve*.a \
usr/lib/*.so* \ usr/lib/*.so* \
usr/lib/arm-linux-gnueabihf \ usr/lib/arm-linux-gnueabihf \
usr/lib/jvm/java-6-openjdk-armhf/include \ usr/lib/jvm/java-6-openjdk-armhf/include \
-7
View File
@@ -279,13 +279,6 @@
"dest": "external/tarballs", "dest": "external/tarballs",
"dest-filename": "@ZMF_TARBALL@" "dest-filename": "@ZMF_TARBALL@"
}, },
{
"url": "https://dev-www.libreoffice.org/src/@LPSOLVE_TARBALL@",
"sha256": "@LPSOLVE_SHA256SUM@",
"type": "file",
"dest": "external/tarballs",
"dest-filename": "@LPSOLVE_TARBALL@"
},
{ {
"url": "https://dev-www.libreoffice.org/src/@MARIADB_CONNECTOR_C_TARBALL@", "url": "https://dev-www.libreoffice.org/src/@MARIADB_CONNECTOR_C_TARBALL@",
"sha256": "@MARIADB_CONNECTOR_C_SHA256SUM@", "sha256": "@MARIADB_CONNECTOR_C_SHA256SUM@",