diff --git a/.gitignore b/.gitignore index ad9d7f7..0d0f370 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ __pycache__/ .nox/ *.d /SolverComponent +/ampl.lic diff --git a/AMPLSolver.hpp b/AMPLSolver.hpp index cc14f2b..9a03df6 100644 --- a/AMPLSolver.hpp +++ b/AMPLSolver.hpp @@ -108,7 +108,10 @@ private: // The problem is received as an AMPL file in a message. However, the AMPL // interface allows the loading of problem and data files on an existing // AMPL object, and the AMPL API object is therefore reused when a new - // problem file is received. + // problem file is received. The problem definition is protected so that + // derived classes may solve the problem directly. + +protected: ampl::AMPL ProblemDefinition; @@ -135,7 +138,8 @@ private: public: - static constexpr std::string_view DataFileTopic = "AMPL::DataFileUpdates"; + static constexpr std::string_view DataFileTopic + = "eu.nebulouscloud.optimiser.solver.data"; // The message defining the data file is a JSON topic message with the same // structure as the optimisation problem message: It contains only one diff --git a/MakeSolver.sh b/MakeSolver.sh index db9682d..5c3c8ba 100644 --- a/MakeSolver.sh +++ b/MakeSolver.sh @@ -12,28 +12,33 @@ # License: MPL2.0 (https://www.mozilla.org/en-US/MPL/2.0/) # ============================================================================== -# Installing the development framework for the distribution +# Installing the development framework for the distribution. Must be run +# as root on the machine - put 'sudo' in front if the build user is not root. -dnf --assumeyes group 'Development Tools' -dnf --assumeyes install ccache qpid-proton-cpp* json-devel coin-or-Couenne +dnf --assumeyes install gcc-c++ make git boost boost-devel ccache \ +qpid-proton-cpp* jsoncpp-devel coin-or-Couenne wget # Cloning the open source dependencies -mkdir Externals -cd Externals git clone https://github.com/jarro2783/cxxopts.git CxxOpts git clone https://github.com/GeirHo/TheronPlusPlus.git Theron++ -cd +mkdir Theron++/Bin + +# Clone the solver component + +git clone https://opendev.org/nebulous/optimiser-solver.git Solver # Installing the AMPL library wget https://portal.ampl.com/external/?url=\ -https://portal.ampl.com/dl/amplce/ampl.linux64.tgz -tar --file=ampl.linux64.tgz --extract --directory=Externals/AMPL -cp ampl.lic Externals/AMPL +https://portal.ampl.com/dl/amplce/ampl.linux64.tgz -O ampl.linux64.tgz +tar --file=ampl.linux64.tgz --extract +mv ampl.linux-intel64 AMPL +rm ampl.linux64.tgz +#cp ampl.lic AMPL # Building the solver component -make SolverComponent -e THERON=Externals/Theron++ \ -AMPL_INCLUDE=Externals/AMPL/amplapi/include AMPL_LIB=Externals/AMPL/amplapi/lib\ -CxxOpts_DIR=Externals/CxxOpts/include +make -C Solver SolverComponent -e THERON=../Theron++ \ +AMPL_INCLUDE=../AMPL/amplapi/include AMPL_LIB=../AMPL/amplapi/lib \ +CxxOpts_DIR=../CxxOpts/include diff --git a/Solver.hpp b/Solver.hpp index 1d02eb7..87c8a9c 100644 --- a/Solver.hpp +++ b/Solver.hpp @@ -141,8 +141,8 @@ public: { public: - static constexpr - std::string_view MessageIdentifier = "Solver::ApplicationExecutionContext"; + static constexpr std::string_view MessageIdentifier + = "eu.nebulouscloud.optimiser.solver.context"; ApplicationExecutionContext( const ContextIdentifierType & TheIdentifier, const TimePointType MicroSecondTimePoint, @@ -207,7 +207,8 @@ public: static constexpr std::string_view ObjectiveValues = "ObjectiveValues"; static constexpr std::string_view VariableValues = "VariableValues"; - static constexpr std::string_view MessageIdentifier = "Solver::Solution"; + static constexpr std::string_view MessageIdentifier + = "eu.nebulouscloud.optimiser.solver.solution"; Solution( const ContextIdentifierType & TheIdentifier, const TimePointType MicroSecondTimePoint, @@ -244,8 +245,8 @@ public: { public: - static constexpr - std::string_view MessageIdentifier = "Solver::OptimisationProblem"; + static constexpr std::string_view MessageIdentifier + = "eu.nebulouscloud.optimiser.solver.model"; OptimisationProblem( const JSON & TheProblem ) : JSONTopicMessage( std::string( MessageIdentifier ), TheProblem ) diff --git a/makefile b/makefile index b804975..7172cf0 100644 --- a/makefile +++ b/makefile @@ -98,8 +98,8 @@ CXXFLAGS = $(GENERAL_OPTIONS) $(INCLUDE_DIRECTORIES) $(DEPENDENCY_FLAGS) \ # requires the full static path to the custom Theron library. CFLAGS = $(DEPENDENCY_FLAGS) $(OPTIMISATION_FLAG) $(GENERAL_OPTIONS) -LDFLAGS = -fuse-ld=gold -ggdb -D_DEBUG -pthread -l$(THERON)/Theron++.a \ - -lqpid-proton-cpp -l$(AMPL_LIB)/libampl.so +LDFLAGS = -fuse-ld=gold -ggdb -D_DEBUG -pthread $(THERON)/Theron++.a \ + -lqpid-proton-cpp $(AMPL_LIB)/libampl.so #------------------------------------------------------------------------------ # Theron library