Commit 16c5f50f authored by Dmitry Bagaev's avatar Dmitry Bagaev
Browse files

upd

parent fa309f2e
......@@ -171,7 +171,7 @@ int main(int argc, char **argv) {
if (rank == 0) std::cout << "Solving with " << solverName << std::endl;
TTSP::OptimizationParameter tau("tau", std::make_pair(-4, -1), 0.1, -3, TTSP::OptimizationParameterType::EXPONENT);
TTSP::OptimizationParameter tau("tau", std::make_pair(-4, -1), 0.1, -3, TTSP::OptimizationParameterType::PARAMETER_TYPE_EXPONENT);
//TTSP::OptimizationParameter q("q", {0, 1, 2, 3, 4}, 2);
//TTSP::OptimizationParameter eps("eps", {1e-7, 1e-6, 1e-5, 1e-4, 1e-3}, 1e-5);
TTSP::OptimizationParameterEntries entries;
......@@ -207,7 +207,7 @@ int main(int argc, char **argv) {
TTSP::OptimizerInterface *topt = TTSP::Optimizers::GetOptimizer(optimizerType, parameters, properties, 50);
topt->SetVerbosityLevel(TTSP::OptimizerVerbosityLevel::Level3);
topt->SetRestartStrategy(TTSP::OptimizerRestartStrategy::RESTART_WITH_BEST, 10);
topt->SetRestartStrategy(TTSP::OptimizerRestartStrategy::RESTART_STRATEGY_WITH_BEST, 10);
while (!series.end()) {
......
......@@ -21,8 +21,8 @@ namespace TTSP {
/// - DEFAULT - parameter values should be used as is
/// - EXPONENT - parameter values should be converted to 10^v
enum class OptimizationParameterType {
DEFAULT,
EXPONENT
PARAMETER_TYPE_DEFAULT,
PARAMETER_TYPE_EXPONENT
};
/// This class is used to define a solver parameter for optimization algortihms
......@@ -46,7 +46,7 @@ namespace TTSP {
/// @param default_value - Default value for this parameter
/// @param type - Parameter type
OptimizationParameter(const std::string &name, const OptimizationParameterRange &range, double step,
double default_value, OptimizationParameterType type = OptimizationParameterType::DEFAULT);
double default_value, OptimizationParameterType type = OptimizationParameterType::PARAMETER_TYPE_DEFAULT);
/// Default constructor to define an OptimizationParameter with list of possible values
/// @param name - Name of a parameter
......@@ -54,7 +54,7 @@ namespace TTSP {
/// @param default_value - Default value for this parameter
/// @param type - Parameter type
OptimizationParameter(const std::string &name, const std::vector<double> &values,
double default_value, OptimizationParameterType type = OptimizationParameterType::DEFAULT);
double default_value, OptimizationParameterType type = OptimizationParameterType::PARAMETER_TYPE_DEFAULT);
/// Copy constructor
/// @param other - OptimizationParameter to make copy of
......@@ -338,8 +338,8 @@ namespace TTSP {
};
enum class OptimizerRestartStrategy {
NO_RESTART,
RESTART_WITH_BEST
RESTART_STRATEGY_NO_RESTART,
RESTART_STRATEGY_WITH_BEST
};
typedef std::pair<bool, double> OptimizationFunctionInvokeResult;
......@@ -348,7 +348,7 @@ namespace TTSP {
private:
OptimizerVerbosityLevel verbosity = OptimizerVerbosityLevel::Level0;
OptimizerRestartStrategy restart_strategy = OptimizerRestartStrategy::NO_RESTART;
OptimizerRestartStrategy restart_strategy = OptimizerRestartStrategy::RESTART_STRATEGY_NO_RESTART;
std::size_t max_fails = std::numeric_limits<std::size_t>::max();
std::size_t fails_count = 0;
......
......@@ -90,9 +90,9 @@ namespace TTSP {
double OptimizationParameterPoint::convert(double value, OptimizationParameterType type) {
switch (type) {
case OptimizationParameterType::DEFAULT:
case OptimizationParameterType::PARAMETER_TYPE_DEFAULT:
return value;
case OptimizationParameterType::EXPONENT:
case OptimizationParameterType::PARAMETER_TYPE_EXPONENT:
return std::pow(10, value);
default:
return value;
......@@ -394,9 +394,9 @@ namespace TTSP {
if (this->fails_count > this->max_fails) {
switch (restart_strategy) {
case OptimizerRestartStrategy::NO_RESTART:
case OptimizerRestartStrategy::RESTART_STRATEGY_NO_RESTART:
break;
case OptimizerRestartStrategy::RESTART_WITH_BEST:
case OptimizerRestartStrategy::RESTART_STRATEGY_WITH_BEST:
RestartWithBestStrategy();
break;
default:
......
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