Skip to content

Commit

Permalink
Rename plateau_force_trying_another_variable in forgotten files
Browse files Browse the repository at this point in the history
  • Loading branch information
richoux committed Jun 19, 2024
1 parent 2266621 commit 9f7ca4b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
10 changes: 5 additions & 5 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

All notable changes to this project will be documented in this file, since GHOST 2.0.0.

## [3.xx] - 2024-xx-xx
- Changed Option.percent_chance_escape_plateau with Option.percent_chance_force_trying_on_plateau, as well as some printed traces.

## [3.1.0] - 2024-03-11
- Add Random Walk and Hill Climbing as search algorithms, for landscape analysis.
- Minor changes in the global solver algorithm, such as removing the probability to force tabu-marking a variable.
Expand All @@ -17,9 +20,7 @@ All notable changes to this project will be documented in this file, since GHOST
- Changed the interface `Solver::solve` -> `Solver::fast_search`, to be coherent with the new `Solver::complete_search`

## [2.8.2] - 2023-07-21
- Fix a mistake in the final cost of an objective function to
maximize, where the value v needed to be reset to the opposite value
-v.
- Fix a mistake in the final cost of an objective function to maximize, where the value v needed to be reset to the opposite value -v.

## [2.8.1] - 2023-06-22
- Change Cmake and build.sh to compile the library for different Android architectures.
Expand All @@ -28,8 +29,7 @@ All notable changes to this project will be documented in this file, since GHOST
- Now allow modeling pure optimization problems.

## [2.7.0] - 2023-05-30
- Slight memory management improvement, by pre-allocating memory
during the search.
- Slight memory management improvement, by pre-allocating memory during the search.

## [2.6.0] - 2023-01-24
- Add the AllEqual global constraint.
Expand Down
2 changes: 1 addition & 1 deletion include/options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace ghost
std::shared_ptr<Print> print; //!< Allowing custom solution print (by derivating a class from ghost::Print)
int tabu_time_local_min; //!< Number of local moves a variable of a local minimum is marked tabu.
int tabu_time_selected; //!< Number of local moves a selected variable is marked tabu.
int percent_chance_escape_plateau; //!< Percentage of chance to espace a (1-dimension, ie, related to 1 variable) plateau rather than exploring it.
int percent_chance_force_trying_on_plateau; //!< Percentage of chance to force trying another variable rather than doing a move on a plateau.
int reset_threshold; //!< Number of variables marked as tabu required to trigger a reset.
int restart_threshold; //!< Trigger a restart every 'restart_threshold' reset. Set to 0 to never trigger restarts.
int number_variables_to_reset; //!< Number of variables to randomly change the value at each reset.
Expand Down
6 changes: 3 additions & 3 deletions include/search_unit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,17 +540,17 @@ namespace ghost
}
}

// B. Plateau management (local move on the plateau, but options.percent_chance_escape_plateau
// B. Plateau management (local move on the plateau, but options.percent_chance_force_trying_on_plateau
// of chance to escape it and mark the variable as tabu.)
void plateau_management( int variable_to_change, int new_value, const std::map< int, std::vector<double>>& delta_errors )
{
if( rng.uniform(1, 100) <= options.percent_chance_escape_plateau )
if( rng.uniform(1, 100) <= options.percent_chance_force_trying_on_plateau )
{
data.tabu_list[ variable_to_change ] = options.tabu_time_local_min + data.local_moves;
must_compute_variable_candidates = true;
++data.plateau_force_trying_another_variable;
#if defined GHOST_TRACE
COUT << "Escape from plateau; variables marked as tabu.\n";
COUT << "Force the exploration of another variable on a plateau; current variable marked as tabu.\n";
#endif
}
else
Expand Down
12 changes: 6 additions & 6 deletions include/solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,8 @@ namespace ghost
if( _options.tabu_time_selected < 0 )
_options.tabu_time_selected = 0;

if( _options.percent_chance_escape_plateau < 0 || _options.percent_chance_escape_plateau > 100 )
_options.percent_chance_escape_plateau = 10;
if( _options.percent_chance_force_trying_on_plateau < 0 || _options.percent_chance_force_trying_on_plateau > 100 )
_options.percent_chance_force_trying_on_plateau = 10;

if( _options.reset_threshold < 0 )
_options.reset_threshold = _options.tabu_time_local_min;
Expand All @@ -473,7 +473,7 @@ namespace ghost
_options.number_start_samplings = 10;

#if defined GHOST_RANDOM_WALK || defined GHOST_HILL_CLIMBING
_options.percent_chance_escape_plateau = 0;
_options.percent_chance_force_trying_on_plateau = 0;
_options.number_start_samplings = 1;
_options.tabu_time_local_min = 0;
_options.tabu_time_selected = 0;
Expand Down Expand Up @@ -774,7 +774,7 @@ namespace ghost
<< "Number of variable assignments samplings at start (if custom start and resume are set to false): " << _options.number_start_samplings << "\n"
<< "Variables of local minimum are frozen for: " << _options.tabu_time_local_min << " local moves\n"
<< "Selected variables are frozen for: " << _options.tabu_time_selected << " local moves\n"
<< "Percentage of chance to espace a plateau rather than exploring it: " << _options.percent_chance_escape_plateau << "%\n"
<< "Percentage of chance to force exploring another variable on a plateau: " << _options.percent_chance_force_trying_on_plateau << "%\n"
<< _options.number_variables_to_reset << " variables are reset when " << _options.reset_threshold << " variables are frozen\n";
if( _options.restart_threshold > 0 )
std::cout << "Do a restart each time " << _options.restart_threshold << " resets are performed\n";
Expand Down Expand Up @@ -808,15 +808,15 @@ namespace ghost
<< "Number of search iterations: " << _search_iterations << "\n"
<< "Number of local moves: " << _local_moves << " (including on plateau: " << _plateau_moves << ")\n"
<< "Number of local minimum: " << _local_minimum << "\n"
<< "Number of plateau escapes: " << _plateau_force_trying_another_variable << "\n"
<< "Number of variable exploration forcing on a plateau: " << _plateau_force_trying_another_variable << "\n"
<< "Number of resets: " << _resets << "\n"
<< "Number of restarts: " << _restarts << "\n";

if( _options.parallel_runs )
std::cout << "Total number of search iterations: " << _search_iterations_total << "\n"
<< "Total number of local moves: " << _local_moves_total << " (including on plateau: " << _plateau_moves_total << ")\n"
<< "Total number of local minimum: " << _local_minimum_total << "\n"
<< "Total number of plateau escapes: " << _plateau_force_trying_another_variable_total << "\n"
<< "Total number of variable exploration forcing on a plateau: " << _plateau_force_trying_another_variable_total << "\n"
<< "Total number of resets: " << _resets_total << "\n"
<< "Total number of restarts: " << _restarts_total << "\n";

Expand Down
8 changes: 4 additions & 4 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Options::Options()
print( std::make_shared<Print>() ),
tabu_time_local_min( -1 ),
tabu_time_selected( -1 ),
percent_chance_escape_plateau( -1 ),
percent_chance_force_trying_on_plateau( -1 ),
reset_threshold( -1 ),
restart_threshold( -1 ),
number_variables_to_reset( -1 ),
Expand All @@ -56,7 +56,7 @@ Options::Options( const Options& other )
print( other.print ),
tabu_time_local_min( other.tabu_time_local_min ),
tabu_time_selected( other.tabu_time_selected ),
percent_chance_escape_plateau( other.percent_chance_escape_plateau ),
percent_chance_force_trying_on_plateau( other.percent_chance_force_trying_on_plateau ),
reset_threshold( other.reset_threshold ),
restart_threshold( other.restart_threshold ),
number_variables_to_reset( other.number_variables_to_reset ),
Expand All @@ -71,7 +71,7 @@ Options::Options( Options&& other )
print( std::move( other.print ) ),
tabu_time_local_min( other.tabu_time_local_min ),
tabu_time_selected( other.tabu_time_selected ),
percent_chance_escape_plateau( other.percent_chance_escape_plateau ),
percent_chance_force_trying_on_plateau( other.percent_chance_force_trying_on_plateau ),
reset_threshold( other.reset_threshold ),
restart_threshold( other.restart_threshold ),
number_variables_to_reset( other.number_variables_to_reset ),
Expand All @@ -89,7 +89,7 @@ Options& Options::operator=( Options other )
std::swap( print, other.print );
tabu_time_local_min = other.tabu_time_local_min;
tabu_time_selected = other.tabu_time_selected;
percent_chance_escape_plateau = other.percent_chance_escape_plateau;
percent_chance_force_trying_on_plateau = other.percent_chance_force_trying_on_plateau;
reset_threshold = other.reset_threshold;
restart_threshold = other.restart_threshold;
number_variables_to_reset = other.number_variables_to_reset;
Expand Down

0 comments on commit 9f7ca4b

Please sign in to comment.