1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-25 22:53:19 +00:00

rogueviz::sag:: further new options

This commit is contained in:
Zeno Rogue 2022-08-26 12:43:59 +02:00
parent ec3bb7a5df
commit 3080e5d05b

View File

@ -215,8 +215,6 @@ namespace sag {
// std::mt19937 los;
bool infullsa;
double cost;
vector<double> chgs;
@ -370,6 +368,33 @@ namespace sag {
reassign();
}
void dofullsa_iterations(int saiter) {
sagmode = sagSA;
decltype(SDL_GetTicks()) t1 = -999999;
for(int i=0; i<saiter; i++) {
temperature = hightemp - ((i+.5)/saiter*(hightemp-lowtemp));
numiter++;
sag::saiter();
if(numiter % 10000 == 0) {
auto t2 = SDL_GetTicks();
if(t2 - t1 > 1000) {
t1 = t2;
println(hlog, format("it %8d temp %6.4f [1/e at %13.6f] cost = %f ",
numiter, double(sag::temperature), (double) exp(sag::temperature),
double(sag::cost)));
}
}
}
temperature = -5;
sagmode = sagOff;
reassign();
}
void iterate() {
if(!sagmode) return;
int t1 = SDL_GetTicks();
@ -953,6 +978,7 @@ int readArgs() {
else if(argis("-sagrt")) {
shift(); sag::lgsag.R = argf();
shift(); sag::lgsag.T = argf();
if(sag::logistic_cost) compute_loglik_tab();
}
else if(argis("-sag_use_loglik")) {
shift(); sag::logistic_cost = argi();
@ -1003,6 +1029,9 @@ int readArgs() {
else if(argis("-sagfull")) {
shift(); sag::dofullsa(argi());
}
else if(argis("-sagfulli")) {
shift(); sag::dofullsa_iterations(argi());
}
else if(argis("-sagviz")) {
sag::vizsa_start = SDL_GetTicks();
shift(); sag::vizsa_len = argi();
@ -1010,6 +1039,9 @@ int readArgs() {
else if(argis("-sagstats")) {
output_stats();
}
else if(argis("-sagstats-logid")) {
shift(); logid = argi();
}
// (5) save the positioning
else if(argis("-sagsave")) {
PHASE(3); shift(); sag::save_sag_solution(args());