Skip to content

Commit

Permalink
spent time on demo02
Browse files Browse the repository at this point in the history
  • Loading branch information
igormcoelho committed May 26, 2024
1 parent 0d8cd4d commit 67707c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions demo/02_QuickstartKP_SA/mainKP-fcore-ex-part4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ BasicSimulatedAnnealing<ESolutionKP> sa{
demo.evalKP, initRand, demo.nsFlip, 0.98, 100, 99999, rg};
// executa o SA e coleta o 'status' de saída
// passa um 'Criterio de Parada' por tempo (= 10 segundos)
optframe::Timer t;
auto searchOut = sa.search(
StopCriteria<ESolutionKP::second_type>{10.0}); // 10.0 seconds max
std::cout << "spent time: " << t.now() << "s" << std::endl;
// pega melhor solução do método SA
ESolutionKP melhor = *searchOut.best; //*sa.getBestSolution();
std::cout << "======== Imprime melhor solução do SA ========" << std::endl;
Expand Down
2 changes: 2 additions & 0 deletions demo/02_QuickstartKP_SA/mainKP-fcore-ex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ BasicSimulatedAnnealing<ESolutionKP> sa{
demo.evalKP, initRand, demo.nsFlip, 0.98, 100, 99999, rg};
// executa o SA e coleta o 'status' de saída
// passa um 'Criterio de Parada' por tempo (= 10 segundos)
optframe::Timer t;
auto searchOut = sa.search(
StopCriteria<ESolutionKP::second_type>{10.0}); // 10.0 seconds max
std::cout << "spent time: " << t.now() << "s" << std::endl;
// pega melhor solução do método SA
ESolutionKP melhor = *searchOut.best; //*sa.getBestSolution();
std::cout << "======== Imprime melhor solução do SA ========" << std::endl;
Expand Down

0 comments on commit 67707c4

Please sign in to comment.