public void reinforceNet(T seeker, ref HoningNetwork <T> net) { HoningNode <T> node = net.getHoningNode(seeker); if (node == null) { return; } int clique_size = node.clique.Count; foreach (T k_i in node.clique.Keys) { foreach (T K_j in node.clique.Keys) { int i = getRulerID(k_i); int j = getRulerID(K_j); ruler[i][j] += clique_size / total_internal_nodes; } } }
public void seek_by_card(HoningNetwork <String> net, String card_name, int return_count, float threshold, out List <String> result) { // Retorno padr'ao result = null; if (return_count <= 0) { return; } // Preparar output Dictionary <String, HoningNode <String> > output; Dictionary <String, HoningNode <String> > output_spell; Dictionary <String, HoningNode <String> > output_others; // Resultados para uso no site result = new List <String>(); // Preparar entradas da rede de honing HoningNode <String> working_node = net.getHoningNode(card_name); List <String> bridges = new List <String>(); if (working_node == null) { return; } foreach (KeyValuePair <String, HoningNode <String> > key_pair in working_node.clique) { bridges.Add(key_pair.Value.holder); } List <String> spellList = new List <string>(); List <String> minionList = new List <string>(); spellList.Add("spell"); minionList.Add("minion"); // Recrutamento de neurds net.recruitNeurds(bridges, out output);//, spellList); //net.recruitNeurds(bridges, out output_spell, minionList); net.keepWithMicrofeature(ref output, out output_others, "minion"); net.keepWithMicrofeature(ref output, out output_spell, "spell"); // Verifica validade do threshold if (threshold > 1.0f) { threshold = 1.0f; } Random rand_obj = new Random(); HoningNode <String> node = net.getHoningNode("Malygos"); // Prepara'cao final de output para o site while (return_count > 0) { foreach (KeyValuePair <String, HoningNode <String> > key_pair in output) { float rand_prob = (float)rand_obj.NextDouble(); if (rand_prob >= threshold) { result.Add(key_pair.Key); return_count--; break; } } // Fim foreach } // Fim while*/ } // Fim seek_by_card