From 5a19fffd8f845ab46933544011cd6961033fbc78 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 23 Oct 2022 16:09:32 +0200 Subject: [PATCH] rogueviz::sag:: smMatch method --- rogueviz/sag.cpp | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/rogueviz/sag.cpp b/rogueviz/sag.cpp index 9af9cde5..ba9424b3 100644 --- a/rogueviz/sag.cpp +++ b/rogueviz/sag.cpp @@ -78,11 +78,15 @@ namespace sag { vector sagedges; vector> edges_yes, edges_no; - enum eSagMethod { smClosest, smLogistic }; + enum eSagMethod { smClosest, smLogistic, smMatch }; eSagMethod method; - bool logistic_repeat; + bool loglik_repeat; + /* parameters for smMatch */ + ld match_a = 1, match_b = 1; + + /* parameters for smLogistic */ dhrg::logistic lgsag(1, 1); vector loglik_tab_y, loglik_tab_n; @@ -228,6 +232,7 @@ namespace sag { for(int i=0; i hubval; @@ -245,6 +250,19 @@ namespace sag { return -cost; } + if(method == smMatch) { + vertexdata& vd = vdata[vid]; + for(int j=0; jweight2 - match_b; + cost += dist * dist; + } + } + return cost; + } + vertexdata& vd = vdata[vid]; for(int j=0; j 1 && method == smLogistic && logistic_repeat) { + if(d > 1 && loglik_repeat) { vizsa_start = ticks; optimize_sag_loglik(); output_stats();