CoinMPSolver did the whole job in one function: sample the model by perturbing each variable, build the CoinMP matrix from those coefficients, solve, and read the result back. Move the matrix build and solve into a standalone helper, coinmpSolveLinearModel, that takes the sampled coefficients plus the variable bounds and column types and returns the solution and status. The helper treats the first entry of each cell's coefficient vector as the value of an affine model at the origin and the rest as the per variable slopes, which is what the existing sampling already produces. That keeps the same convention while letting a future caller supply coefficients sampled around a different point and its own bounds, which is what a sequential linear programming loop needs. No behaviour change. CoinMPSolver still samples and sets up bounds and column types exactly as before, then calls the helper. The CoinMP solver unit test passes unchanged. Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> Change-Id: I6d373a48caa9d67a932a599068368bae978f1f22 Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/4648 Tested-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit 197f790a93880f56dd53db43e6bbb61c22ccfdc2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208337 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
59 lines
1.7 KiB
Makefile
59 lines
1.7 KiB
Makefile
# -*- 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/.
|
|
#
|
|
# 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 .
|
|
#
|
|
|
|
$(eval $(call gb_Library_Library,solver))
|
|
|
|
$(eval $(call gb_Library_set_componentfile,solver,sc/source/solver/solver,services))
|
|
|
|
$(eval $(call gb_Library_add_componentimpls,solver, \
|
|
$(if $(ENABLE_COINMP),coinmp) \
|
|
))
|
|
|
|
$(eval $(call gb_Library_use_sdk_api,solver))
|
|
|
|
$(eval $(call gb_Library_set_include,solver,\
|
|
$$(INCLUDE) \
|
|
-I$(SRCDIR)/sc/inc \
|
|
-I$(SRCDIR)/sc/source/solver \
|
|
))
|
|
|
|
$(eval $(call gb_Library_use_libraries,solver,\
|
|
comphelper \
|
|
cppu \
|
|
cppuhelper \
|
|
sal \
|
|
sc \
|
|
utl \
|
|
i18nlangtag \
|
|
))
|
|
|
|
$(eval $(call gb_Library_use_externals,solver,\
|
|
boost_headers \
|
|
coinmp \
|
|
))
|
|
|
|
$(eval $(call gb_Library_add_exception_objects,solver,\
|
|
sc/source/solver/SwarmSolver \
|
|
sc/source/solver/SolverComponent \
|
|
$(if $(ENABLE_COINMP), sc/source/solver/CoinMPSolver) \
|
|
$(if $(ENABLE_COINMP), sc/source/solver/CoinMPModel) \
|
|
))
|
|
|
|
# vim: set noet sw=4 ts=4:
|