Commit 5bd57ad9 authored by Dmitry Bagaev's avatar Dmitry Bagaev
Browse files

TTSP -> Optimizer rename

parent 5f6c859f
......@@ -35,8 +35,8 @@ option(USE_SOLVER_MONDRIAAN "Use Mondriaan for matrix reordering" OFF)
option(USE_SOLVER_PETSC "Use PETSc solvers" OFF)
option(USE_SOLVER_TRILINOS "Use Trilinos solvers" OFF)
option(USE_SOLVER_SUPERLU "Use SuperLU solver" OFF)
option(USE_TTSP "Use Trace and Tune Solver Parameters optimization toolkit" OFF)
option(USE_TTSP_LIMBO "Compile TTSP module against Limbo library to provide Bayesian optimization algorithm" OFF)
option(USE_OPTIMIZER "Use Optimization toolkit" OFF)
option(USE_OPTIMIZER_BAYESIAN "Compile Optimization module against Limbo library to provide Bayesian optimization algorithm" OFF)
#option(USE_AUTODIFF_ASMJIT "Use AsmJit for automatic differentiation" OFF)
#option(USE_AUTODIFF_EXPRESSION_TEMPLATES "Use c++ expression templates for automatic differentiation" OFF)
......@@ -77,7 +77,7 @@ if(TEST_FORTRAN_ANI3D)
endif()
if(USE_TTSP_LIMBO)
if(USE_OPTIMIZER_BAYESIAN)
include_directories(/Users/bvdmitri/Projects/CXX/limbo/src)
target_link_libraries(inmost /Users/bvdmitri/Projects/CXX/limbo/build/src/liblimbo.a)
......@@ -347,7 +347,7 @@ set(INMOST_INSTALL_HEADERS Source/Headers/inmost.h
Source/Headers/inmost_xml.h
Source/Headers/inmost_variable.h
Source/Headers/inmost_block_variable.h
Source/Headers/inmost_ttsp.h
Source/Headers/inmost_optimizer.h
Source/Headers/container.hpp)
#if( COMPILE_EXAMPLES )
......@@ -393,7 +393,7 @@ set_property(TARGET inmost PROPERTY PUBLIC_HEADER
"${PROJECT_SOURCE_DIR}/Source/Headers/inmost_variable.h"
"${PROJECT_SOURCE_DIR}/Source/Headers/inmost_block_variable.h"
"${PROJECT_SOURCE_DIR}/Source/Headers/inmost_xml.h"
"${PROJECT_SOURCE_DIR}/Source/Headers/inmost_ttsp.h"
"${PROJECT_SOURCE_DIR}/Source/Headers/inmost_optimizer.h"
"${PROJECT_SOURCE_DIR}/Source/Headers/container.hpp")
#if( COMPILE_EXAMPLES )
......
......@@ -5,9 +5,9 @@ if (USE_MESH)
add_subdirectory(GridGen)
add_subdirectory(GridTools)
endif (USE_MESH)
if (USE_TTSP)
add_subdirectory(TTSPSolve)
add_subdirectory(TTSPFunction)
if (USE_OPTIMIZER)
add_subdirectory(OptimizerSolve)
add_subdirectory(OptimizerFunction)
endif ()
if (USE_SOLVER)
add_subdirectory(DrawMatrix)
......
project(OptimizerFunction)
set(SOURCE main.cpp)
add_subdirectory(function)
include_directories(function)
add_executable(OptimizerFunction ${SOURCE})
target_link_libraries(OptimizerFunction inmost)
if(USE_MPI)
message("linking OptimizerFunction with MPI")
target_link_libraries(OptimizerFunction ${MPI_LIBRARIES})
if(MPI_LINK_FLAGS)
set_target_properties(OptimizerFunction PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
install(TARGETS OptimizerFunction EXPORT inmost-targets RUNTIME DESTINATION bin)
......@@ -6,7 +6,7 @@
#define INMOST_DYNAMIC_FUNCTION_H
#include <utility>
#include <inmost_ttsp.h>
#include <inmost_optimizer.h>
class DynamicFunction {
public:
......@@ -20,12 +20,12 @@ public:
virtual std::pair<double, double> GetYRange() const noexcept = 0;
virtual TTSP::OptimizationParameterType GetXParameterType() const noexcept {
return TTSP::OptimizationParameterType::PARAMETER_TYPE_DEFAULT;
virtual INMOST::OptimizationParameterType GetXParameterType() const noexcept {
return INMOST::OptimizationParameterType::PARAMETER_TYPE_DEFAULT;
}
virtual TTSP::OptimizationParameterType GetYParameterType() const noexcept {
return TTSP::OptimizationParameterType::PARAMETER_TYPE_DEFAULT;
virtual INMOST::OptimizationParameterType GetYParameterType() const noexcept {
return INMOST::OptimizationParameterType::PARAMETER_TYPE_DEFAULT;
}
};
......
......@@ -45,7 +45,7 @@ std::pair<double, double> DynamicR2::GetYRange() const noexcept {
return std::make_pair(0, 4);
}
TTSP::OptimizationParameterType DynamicR2::GetXParameterType() const noexcept {
return TTSP::OptimizationParameterType::PARAMETER_TYPE_EXPONENT;
INMOST::OptimizationParameterType DynamicR2::GetXParameterType() const noexcept {
return INMOST::OptimizationParameterType::PARAMETER_TYPE_EXPONENT;
}
......@@ -25,7 +25,7 @@ public:
std::pair<double, double> GetYRange() const noexcept override;
TTSP::OptimizationParameterType GetXParameterType() const noexcept override;
INMOST::OptimizationParameterType GetXParameterType() const noexcept override;
};
#endif //INMOST_DYNAMIC_R2_H
......@@ -6,9 +6,9 @@
#include <dynamic_x2.h>
#include <dynamic_r2.h>
#include <inmost_ttsp.h>
#include <inmost_optimizer.h>
using namespace TTSP;
using namespace INMOST;
int main(int argc, char **argv) {
......@@ -54,7 +54,7 @@ int main(int argc, char **argv) {
std::cout << "-of, --out-folder <out folder path>" << std::endl;
std::cout << "-w, --wait" << std::endl;
std::cout << " Available optimizers:" << std::endl;
std::vector<std::string> availableOptimizers = TTSP::Optimizers::GetAvailableOptimizers();
std::vector<std::string> availableOptimizers = INMOST::Optimizers::GetAvailableOptimizers();
for (auto it = availableOptimizers.begin(); it != availableOptimizers.end(); ++it) {
std::cout << " " << *it << std::endl;
......@@ -133,18 +133,18 @@ int main(int argc, char **argv) {
OptimizationParameter x("x", xrange, (xrange.second - xrange.first) / x_steps, x_default_found ? x_default : (xrange.first + xrange.second) / 2.0, f->GetXParameterType());
OptimizationParameter y("y", yrange, (yrange.second - yrange.first) / y_steps, y_default_found ? y_default : (yrange.first + yrange.second) / 2.0, f->GetYParameterType());
TTSP::OptimizationParameterEntries entries;
INMOST::OptimizationParameterEntries entries;
entries.emplace_back(std::make_pair(x, x.GetDefaultValue()));
if (use_second_parameter) {
entries.emplace_back(std::make_pair(y, y.GetDefaultValue()));
}
TTSP::OptimizationParameters parameters(entries, -1.0);
INMOST::OptimizationParameters parameters(entries, -1.0);
if (!TTSP::Optimizers::IsOptimizerAvailable(optimizer_type)) {
if (!INMOST::Optimizers::IsOptimizerAvailable(optimizer_type)) {
std::cout << "Optimizer " << optimizer_type << " not found" << std::endl;
std::cout << " Available optimizers:" << std::endl;
std::vector<std::string> availableOptimizers = TTSP::Optimizers::GetAvailableOptimizers();
std::vector<std::string> availableOptimizers = INMOST::Optimizers::GetAvailableOptimizers();
for (auto it = availableOptimizers.begin(); it != availableOptimizers.end(); ++it) {
std::cout << " " << *it << std::endl;
......
project(OptimizerSolve)
set(SOURCE main.cpp series.cpp series.h)
add_executable(OptimizerSolve ${SOURCE})
target_link_libraries(OptimizerSolve inmost)
if(USE_MPI)
message("linking OptimizerSolve with MPI")
target_link_libraries(OptimizerSolve ${MPI_LIBRARIES})
if(MPI_LINK_FLAGS)
set_target_properties(OptimizerSolve PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
endif()
endif(USE_MPI)
if(USE_SOLVER)
if(USE_SOLVER_ANI)
message("linking OptimizerSolve with ani3d and BLAS")
target_link_libraries(OptimizerSolve ani3d ${BLAS_LIBRARIES})
if(BLAS_LINKER_FLAGS)
set_target_properties(OptimizerSolve PROPERTIES LINK_FLAGS "${BLAS_LINKER_FLAGS}")
endif()
endif()
if(USE_SOLVER_PETSC)
message("linking OptimizerSolve with PETSc")
target_link_libraries(OptimizerSolve ${PETSC_LIBRARIES})
endif()
if(USE_SOLVER_TRILINOS)
message("linking OptimizerSolve with Trilinos")
target_link_libraries(OptimizerSolve ${Trilinos_LIBRARIES} ${Trilinos_TPL_LIBRARIES})
endif()
if(USE_SOLVER_METIS)
message("linking OptimizerSolve with Metis")
target_link_libraries(OptimizerSolve ${METIS_LIBRARIES})
endif()
if(USE_SOLVER_MONDRIAAN)
message("linking OptimizerSolve with Mondriaan")
target_link_libraries(OptimizerSolve ${MONDRIAAN_LIBRARIES})
endif()
if(USE_SOLVER_SUPERLU)
message("linking OptimizerSolve with SuperLU")
target_link_libraries(OptimizerSolve ${SUPERLU_LIBRARIES})
endif()
endif()
if(USE_PARTITIONER)
if(USE_PARTITIONER_ZOLTAN)
message("linking OptimizerSolve with Zoltan")
target_link_libraries(OptimizerSolve ${ZOLTAN_LIBRARIES})
endif()
if(USE_PARTITIONER_PARMETIS)
message("linking OptimizerSolve with ParMETIS")
target_link_libraries(OptimizerSolve ${PARMETIS_LIBRARIES})
endif()
endif()
install(TARGETS OptimizerSolve EXPORT inmost-targets RUNTIME DESTINATION bin)
......@@ -5,7 +5,7 @@
#include <cmath>
#include <cstdio>
#include <inmost_ttsp.h>
#include <inmost_optimizer.h>
#include "series.h"
#include <Source/Misc/utils.h>
......@@ -68,7 +68,7 @@ int main(int argc, char **argv) {
std::cout << " " << *it << std::endl;
}
std::cout << " Available optimizers:" << std::endl;
std::vector<std::string> availableOptimizers = TTSP::Optimizers::GetAvailableOptimizers();
std::vector<std::string> availableOptimizers = INMOST::Optimizers::GetAvailableOptimizers();
for (auto it = availableOptimizers.begin(); it != availableOptimizers.end(); ++it) {
std::cout << " " << *it << std::endl;
}
......@@ -200,11 +200,11 @@ int main(int argc, char **argv) {
if (rank == 0) std::cout << "Solving with " << solverName << std::endl;
if (!TTSP::Optimizers::IsOptimizerAvailable(optimizerType)) {
if (!INMOST::Optimizers::IsOptimizerAvailable(optimizerType)) {
if (rank == 0) {
std::cout << "Optimizer " << optimizerType << " not found" << std::endl;
std::cout << " Available optimizers:" << std::endl;
std::vector<std::string> availableOptimizers = TTSP::Optimizers::GetAvailableOptimizers();
std::vector<std::string> availableOptimizers = INMOST::Optimizers::GetAvailableOptimizers();
for (auto it = availableOptimizers.begin(); it != availableOptimizers.end(); ++it) {
std::cout << " " << *it << std::endl;
}
......@@ -212,9 +212,9 @@ int main(int argc, char **argv) {
std::exit(0);
}
TTSP::OptimizersConfiguration::FromFile(parametersFilePath);
INMOST::OptimizersConfiguration::FromFile(parametersFilePath);
TTSP::OptimizerProperties properties;
INMOST::OptimizerProperties properties;
properties["tau:use_closest"] = "false";
properties["tau:strict_bound"] = "false";
......@@ -222,12 +222,12 @@ int main(int argc, char **argv) {
properties["eps:use_closest"] = "false";
properties["eps:strict_bound"] = "false";
TTSP::Optimizers::SaveOptimizerOrReplace("test", optimizerType, properties, 9);
INMOST::Optimizers::SaveOptimizerOrReplace("test", optimizerType, properties, 9);
TTSP::OptimizerInterface *topt = TTSP::Optimizers::GetSavedOptimizer("test");
INMOST::OptimizerInterface *topt = INMOST::Optimizers::GetSavedOptimizer("test");
topt->SetVerbosityLevel(TTSP::OptimizerVerbosityLevel::Level1);
topt->SetRestartStrategy(TTSP::OptimizerRestartStrategy::RESTART_STRATEGY_WITH_BEST, 7);
topt->SetVerbosityLevel(INMOST::OptimizerVerbosityLevel::Level1);
topt->SetRestartStrategy(INMOST::OptimizerRestartStrategy::RESTART_STRATEGY_WITH_BEST, 7);
double metrics_total = 0.0;
......@@ -256,10 +256,10 @@ int main(int argc, char **argv) {
for (int k = mbeg; k < mend; ++k) rhs[k] = 1.0;
}
auto invoke = [&solver, &matrix, &rhs, &x](const TTSP::OptimizationParameterPoints &before, const TTSP::OptimizationParameterPoints &after,
void *data) -> TTSP::OptimizationFunctionInvokeResult {
auto invoke = [&solver, &matrix, &rhs, &x](const INMOST::OptimizationParameterPoints &before, const INMOST::OptimizationParameterPoints &after,
void *data) -> INMOST::OptimizationFunctionInvokeResult {
std::for_each(after.begin(), after.end(), [&solver](const TTSP::OptimizationParameterPoint &point) {
std::for_each(after.begin(), after.end(), [&solver](const INMOST::OptimizationParameterPoint &point) {
solver.SetParameter(point.GetName(), INMOST::to_string(point.GetValue()));
});
......@@ -275,18 +275,18 @@ int main(int argc, char **argv) {
double time = Timer() - tmp_time;
std::for_each(before.begin(), before.end(), [&solver](const TTSP::OptimizationParameterPoint &point) {
std::for_each(before.begin(), before.end(), [&solver](const INMOST::OptimizationParameterPoint &point) {
solver.SetParameter(point.GetName(), INMOST::to_string(point.GetValue()));
});
return std::make_pair(is_solved, time);
};
TTSP::OptimizerInterface *optimizer = TTSP::Optimizers::GetSavedOptimizer("test");
INMOST::OptimizerInterface *optimizer = INMOST::Optimizers::GetSavedOptimizer("test");
const TTSP::OptimizationParametersSuggestion &suggestion = optimizer->Suggest(invoke, nullptr);
const INMOST::OptimizationParametersSuggestion &suggestion = optimizer->Suggest(invoke, nullptr);
const TTSP::OptimizationFunctionInvokeResult &result = invoke(suggestion.GetPointsBefore(), suggestion.GetPointsAfter(), nullptr);
const INMOST::OptimizationFunctionInvokeResult &result = invoke(suggestion.GetPointsBefore(), suggestion.GetPointsAfter(), nullptr);
bool is_good = result.first;
double metrics = result.second;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment