mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-09-28 14:08:40 +00:00
rogueviz::sag:: further new options
This commit is contained in:
parent
ec3bb7a5df
commit
3080e5d05b
@ -215,8 +215,6 @@ namespace sag {
|
|||||||
|
|
||||||
// std::mt19937 los;
|
// std::mt19937 los;
|
||||||
|
|
||||||
bool infullsa;
|
|
||||||
|
|
||||||
double cost;
|
double cost;
|
||||||
|
|
||||||
vector<double> chgs;
|
vector<double> chgs;
|
||||||
@ -370,6 +368,33 @@ namespace sag {
|
|||||||
reassign();
|
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() {
|
void iterate() {
|
||||||
if(!sagmode) return;
|
if(!sagmode) return;
|
||||||
int t1 = SDL_GetTicks();
|
int t1 = SDL_GetTicks();
|
||||||
@ -953,6 +978,7 @@ int readArgs() {
|
|||||||
else if(argis("-sagrt")) {
|
else if(argis("-sagrt")) {
|
||||||
shift(); sag::lgsag.R = argf();
|
shift(); sag::lgsag.R = argf();
|
||||||
shift(); sag::lgsag.T = argf();
|
shift(); sag::lgsag.T = argf();
|
||||||
|
if(sag::logistic_cost) compute_loglik_tab();
|
||||||
}
|
}
|
||||||
else if(argis("-sag_use_loglik")) {
|
else if(argis("-sag_use_loglik")) {
|
||||||
shift(); sag::logistic_cost = argi();
|
shift(); sag::logistic_cost = argi();
|
||||||
@ -1003,6 +1029,9 @@ int readArgs() {
|
|||||||
else if(argis("-sagfull")) {
|
else if(argis("-sagfull")) {
|
||||||
shift(); sag::dofullsa(argi());
|
shift(); sag::dofullsa(argi());
|
||||||
}
|
}
|
||||||
|
else if(argis("-sagfulli")) {
|
||||||
|
shift(); sag::dofullsa_iterations(argi());
|
||||||
|
}
|
||||||
else if(argis("-sagviz")) {
|
else if(argis("-sagviz")) {
|
||||||
sag::vizsa_start = SDL_GetTicks();
|
sag::vizsa_start = SDL_GetTicks();
|
||||||
shift(); sag::vizsa_len = argi();
|
shift(); sag::vizsa_len = argi();
|
||||||
@ -1010,6 +1039,9 @@ int readArgs() {
|
|||||||
else if(argis("-sagstats")) {
|
else if(argis("-sagstats")) {
|
||||||
output_stats();
|
output_stats();
|
||||||
}
|
}
|
||||||
|
else if(argis("-sagstats-logid")) {
|
||||||
|
shift(); logid = argi();
|
||||||
|
}
|
||||||
// (5) save the positioning
|
// (5) save the positioning
|
||||||
else if(argis("-sagsave")) {
|
else if(argis("-sagsave")) {
|
||||||
PHASE(3); shift(); sag::save_sag_solution(args());
|
PHASE(3); shift(); sag::save_sag_solution(args());
|
||||||
|
Loading…
Reference in New Issue
Block a user