public void calibration(String hero, HSCardsParser parser, HoningStoneBuilder builder, HSCombosParser combosParser, Dictionary <String, double[]> cardDatasetFull, Dictionary <String, CardObject> cartTable, HSCardOperator op) { net = new HoningNetwork <string>(); string[] lines = System.IO.File.ReadAllLines(hero + "_calibration.cal"); char[] delim = new char[1]; delim[0] = ' '; String highSurprise = lines[0].Split(delim).Last(); String minSurprise = lines[1].Split(delim).Last(); String highEfficiency = lines[2].Split(delim).Last(); String minEfficiency = lines[3].Split(delim).Last(); double.TryParse(highSurprise, out highSurp); double.TryParse(minSurprise, out minSurp); double.TryParse(highEfficiency, out highEff); double.TryParse(minEfficiency, out minEff); List <CardObject> heroCards = parser.objects[hero]; List <CardObject> neutral = parser.objects["Neutral"]; builder.PopulateFromCardData(ref net, ref heroCards); builder.BuildThirdLevel(ref net, ref heroCards); builder.PopulateFromCardData(ref net, ref neutral); builder.BuildThirdLevel(ref net, ref neutral); fixedBayes = new HSHoningBayes(hero.ToLower(), ref combosParser, ref net, ref cardDatasetFull, ref cartTable, 100000); fixedBayes.SaveKNNDataset(hero + "_data.dataset"); Dataset fixedDataset = new Dataset(hero + "_data.dataset", ','); fixedKNN = new KNNEfficiency(fixedDataset); dic = net.getNetwork(); selfAbilityFilter = op.GenerateAbilityFilter(); }
public HoningNetwork <String> BuildNetwork(String jsonString) { // Cria rede simples vazia HoningNetwork <String> new_network = new HoningNetwork <String>(); // Ler json com dados da rede dynamic stuff = JArray.Parse(jsonString); // Popular rede honing foreach (dynamic obj in stuff) { // Persistir carta na rede new_network.insert((String)obj.Card_name); // Popular microfeatures na rede foreach (String mf in obj.Microfeatures) { // Cria mf internal node para rede simples new_network.insert(mf.ToLower()); // Inserir na rede para manipulacao new_network.setParent((String)obj.Card_name, mf.ToLower()); } } // Apenas retorno do objeto return(new_network); }
public Dictionary <String, HoningNode <String> > GetCardsBySingleBound(ref HoningNetwork <String> net, String target, String filter = null) { Dictionary <String, HoningNode <String> > recruit = new Dictionary <string, HoningNode <string> >(); List <String> targets = new List <string>(); targets.Add(target); net.recruitNeurds(targets, out recruit, filter); return(recruit); }
public HSHoningBayes(String hero, ref HSCombosParser combosParser, ref HoningNetwork <String> net, ref Dictionary <String, double[]> cardDataset, ref Dictionary <String, CardObject> cardTable, int comboLimit) { this.net = net; this.cardTable = cardTable; bayesMatrix = new List <double[]>(); globalSurprise = 0.0f; int totalCombos = 0; foreach (int key in combosParser.combos_by_quantity[hero].Keys) { int comboPerQuantity = 0; foreach (ComboNode node in combosParser.combos_by_quantity[hero][key]) { if (comboPerQuantity == comboLimit) { break; } ComboNode combo = node; double[] bayesCombo; GenerateComboVector(ref combo, ref cardDataset, out bayesCombo); bayesMatrix.Add(bayesCombo); comboPerQuantity++; totalCombos++; } } winrates = new double[totalCombos]; // Populate winrates int currentCombo = 0; foreach (int key in combosParser.combos_by_quantity[hero].Keys) { int comboPerQuantity = 0; foreach (ComboNode node in combosParser.combos_by_quantity[hero][key]) { if (comboPerQuantity == comboLimit) { break; } winrates[currentCombo] = node.winrate_mean; comboPerQuantity++; currentCombo++; } } CalculateStatistics(); }
public List <String> GetCardsByBound(ref HoningNetwork <String> net, List <String> targets) { Dictionary <String, HoningNode <String> > recruit = new Dictionary <string, HoningNode <string> >(); net.recruitNeurds(targets, out recruit); List <String> ret = new List <string>(); foreach (String k in recruit.Keys) { ret.Add(recruit[k].holder); } return(ret); }
public void BuildThirdLevel(ref HoningNetwork <String> net, ref List <CardObject> cardData) { //config targets foreach (CardObject card in cardData) { foreach (CardAbility ab in card.abilities) { foreach (String target in ab.target) { net.setParent(ab.ability, target); } } } }
public void BuildRuler(ref HoningNetwork <T> net) { int single_mf_count = net.leafCount(); ruler = new float[single_mf_count][]; for (int i = 0; i < single_mf_count; i++) { ruler[i] = new float[single_mf_count]; for (int j = 0; j < single_mf_count; j++) { ruler[i][j] = 0.0f; } } net.leafIDMapping(out id_mapping, out inverse_id_mapping); total_internal_nodes = single_mf_count; }
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 PopulateFromCardData(ref HoningNetwork <String> net, ref List <CardObject> cardData) { foreach (CardObject card in cardData) { net.insert(card.name, "terminal"); net.insert(card.type, "essential"); net.setParent(card.name, card.type); if (card.race != null) { net.insert(card.race, "essential"); net.setParent(card.name, card.race); } foreach (CardAbility ab in card.abilities) { net.insert(ab.ability, "internal"); net.setParent(card.name, ab.ability); } } }
public List <String> GreedyExpansion( ref HoningNetwork <String> net, ref HSCardExpasionConfiguration config, ref Dictionary <String, CardObject> cardTable, ExpansionGeneralPolitics politic, PriorityPolitics giverPriorities, PriorityPolitics receiverPriorities, String seed) { HSCardCluster base_cluster = GenerateCardCluster(seed, ref cardTable, ref net); if (base_cluster == null) { return(null); } if (config.total_mana == 0) { return(null); } List <String> comboNodes = new List <String>(); List <String> combo = new List <String>(); combo.Add(base_cluster.card); Dictionary <String, bool> markers = new Dictionary <string, Boolean>(); List <String> giver_recruiting; List <String> receiver_recruiting; if (config.giver_inflation) { giver_recruiting = RecruitNeighbours(ref net, ref base_cluster.giver, ref config, ref cardTable, ref politic, ref giverPriorities, ref markers, ref combo); comboNodes.AddRange(giver_recruiting); } if (config.receiver_inflation) { receiver_recruiting = RecruitNeighbours(ref net, ref base_cluster.receiver, ref config, ref cardTable, ref politic, ref receiverPriorities, ref markers, ref combo); comboNodes.AddRange(receiver_recruiting); } while (comboNodes.Count > 0) { String current = comboNodes.First(); comboNodes.Remove(current); HSCardCluster new_cluster = GenerateCardCluster(current, ref cardTable, ref net); if (!markers.ContainsKey(current)) { markers.Add(current, true); } combo.Add(new_cluster.card); if (config.giver_inflation) { giver_recruiting = RecruitNeighbours(ref net, ref new_cluster.giver, ref config, ref cardTable, ref politic, ref giverPriorities, ref markers, ref combo); comboNodes.AddRange(giver_recruiting); } if (config.receiver_inflation) { receiver_recruiting = RecruitNeighbours(ref net, ref new_cluster.receiver, ref config, ref cardTable, ref politic, ref receiverPriorities, ref markers, ref combo); comboNodes.AddRange(receiver_recruiting); } } // Mana threshold 10 mana = 1 turn, 30 mana = 3 turns combo if (config.cutByManaCost) { List <String> new_output = new List <String>(); int total_mana = 0; foreach (String key in combo) { String s = key.ToLower(); int mana_cost; Int32.TryParse(cardTable[s].cost, out mana_cost); total_mana += mana_cost; if (total_mana >= config.total_mana) { break; } new_output.Add(key); if (new_output.Count == config.maxCards) { break; } } return(new_output); } return(combo); }
public void GreedyExpansionDelegated( ref HoningNetwork <String> net, ref HSCardExpasionConfiguration config, ref Dictionary <String, CardObject> cardTable, ExpansionGeneralPolitics politic, PriorityPolitics giverPriorities, PriorityPolitics receiverPriorities, String seed, out List <List <String> > out_subcomboClusters, out List <String> out_simpleComboList) { HSCardCluster base_cluster = GenerateCardCluster(seed, ref cardTable, ref net); out_subcomboClusters = new List <List <string> >(); out_simpleComboList = new List <string>(); if (base_cluster == null) { return; } if (config.total_mana == 0) { return; } List <List <String> > final_form = new List <List <string> >(); List <String> comboNodes = new List <String>(); List <String> combo = new List <String>(); combo.Add(base_cluster.card); Dictionary <String, bool> markers = new Dictionary <string, Boolean>(); List <String> giver_recruiting; List <String> receiver_recruiting; if (config.giver_inflation) { giver_recruiting = RecruitNeighbours(ref net, ref base_cluster.giver, ref config, ref cardTable, ref politic, ref giverPriorities, ref markers, ref combo); comboNodes.AddRange(giver_recruiting); combo.AddRange(giver_recruiting); } if (config.receiver_inflation) { receiver_recruiting = RecruitNeighbours(ref net, ref base_cluster.receiver, ref config, ref cardTable, ref politic, ref receiverPriorities, ref markers, ref combo); comboNodes.AddRange(receiver_recruiting); combo.AddRange(receiver_recruiting); } final_form.Add(combo); // Context filter int voidCount = 0; for (int i = 0; i < comboNodes.Count; i++) { if (comboNodes[i] == "") { voidCount++; } } while (voidCount > 0) { comboNodes.Remove(""); voidCount--; } while (comboNodes.Count > 0) { String current = comboNodes.First(); comboNodes.Remove(current); HSCardCluster new_cluster = GenerateCardCluster(current, ref cardTable, ref net); combo = new List <String>(); combo.Add(new_cluster.card); if (!markers.ContainsKey(current)) { markers.Add(current, true); } if (config.giver_inflation) { giver_recruiting = RecruitNeighbours(ref net, ref new_cluster.giver, ref config, ref cardTable, ref politic, ref giverPriorities, ref markers, ref combo); comboNodes.AddRange(giver_recruiting); combo.AddRange(giver_recruiting); } if (config.receiver_inflation) { receiver_recruiting = RecruitNeighbours(ref net, ref new_cluster.receiver, ref config, ref cardTable, ref politic, ref receiverPriorities, ref markers, ref combo); comboNodes.AddRange(receiver_recruiting); combo.AddRange(receiver_recruiting); } final_form.Add(combo); if (final_form.Count == config.maxCards) { break; } } // Mana threshold 10 mana = 1 turn, 30 mana = 3 turns combo if (config.cutByManaCost) { Dictionary <String, String> keys = new Dictionary <string, string>(); int total_mana = 0; bool breaked = false; foreach (List <String> key in final_form) { foreach (String k in key) { String s = k.ToLower(); if (keys.ContainsKey(k)) { continue; } int mana_cost; Int32.TryParse(cardTable[s].cost, out mana_cost); total_mana += mana_cost; if (total_mana >= config.total_mana) { breaked = true; break; } keys.Add(k, k); if (keys.Count == config.maxCards) { breaked = true; break; } } if (breaked) { break; } } out_simpleComboList = keys.Keys.ToList(); } else { bool breaked = false; foreach (List <String> key in final_form) { foreach (String k in key) { out_simpleComboList.Add(k); if (out_simpleComboList.Count == config.maxCards) { breaked = true; break; } } if (breaked) { break; } } } out_subcomboClusters = final_form; }
void ValidationTests() { HSCardsParser parser = new HSCardsParser("jsonWithTypes.json"); HoningStoneBuilder builder = new HoningStoneBuilder(); Dictionary <String, CardObject> cardTable = new Dictionary <string, CardObject>(); HSCardOperator op = new HSCardOperator(); // Populate all card table foreach (string key in parser.objects.Keys) { List <CardObject> cards_objects = parser.objects[key]; builder.GenCardTableObject(ref cards_objects, ref cardTable); } HSCombosParser combosParser = new HSCombosParser(); //combosParser.PopulateFromHoningNetwork(ref decksParser, ref cardTable, 5); combosParser.PopulateFromJson("ALYCOMBOOK.json"); int maxComboSize = 10; //int maxMana = 50; int maxCombos = 100; Random rand = new Random(); foreach (String hero in parser.objects.Keys) { if (hero == "Neutral") { continue; } HoningNetwork <String> net = new HoningNetwork <string>(); List <CardObject> heroCards = parser.objects[hero]; List <CardObject> neutral = parser.objects["Neutral"]; builder.PopulateFromCardData(ref net, ref heroCards); builder.BuildThirdLevel(ref net, ref heroCards); builder.PopulateFromCardData(ref net, ref neutral); builder.BuildThirdLevel(ref net, ref neutral); HSHoningBayes fixedBayes = new HSHoningBayes(hero.ToLower(), ref combosParser, ref net, ref cardTable); fixedBayes.SaveKNNDataset("ARSDataset.dataset"); Dataset fixedDataset = new Dataset("ARSDataset.dataset", ','); KNNEfficiency fixedKNN = new KNNEfficiency(fixedDataset); HSHoningBayes dynamicBayes = new HSHoningBayes(hero.ToLower(), ref combosParser, ref net, ref cardTable); List <String> Terminals = net.getTerminalList(); // Random Honing config HSCardExpasionConfiguration config = new HSCardExpasionConfiguration(fixedBayes, fixedKNN); config.cutByManaCost = false; config.max_lowerlevel_to_expand = 1; config.giver_inflation = false; // Guided Honing config HSCardExpasionConfiguration configGuided = new HSCardExpasionConfiguration(fixedBayes, fixedKNN); configGuided.cutByManaCost = false; configGuided.max_lowerlevel_to_expand = 1; configGuided.giver_inflation = false; // Tests i and ii control variables double ihs = 0.0f; double iihs = 0.0f; double[] surprise_vec; Double[] comboArray; // Tests i and ii control variables // Tests i, ii, iii, iv, v control variables int mana = 50; double surprise; double efficiency; double creativity; List <String> combo; // Tests i, ii, iii, iv, v control variables int combosize = 5; for (int combos = 0; combos < maxCombos; combos++) { //for (int mana = 2; mana <= maxMana; mana++) //{ //for (int combosize = 2; combosize <= maxComboSize; combosize++) // { // Honing shared seed int RandomicSeed = rand.Next(Terminals.Count); String seed = Terminals[RandomicSeed]; //-------------------------------------------------------------------------------------------------------------------------- // Surpresa estática // (i)totalmente aleatorio (sem honing) /* List<String> randomComboList = new List<String>(); * while(randomComboList.Count < combosize) * { * int randNode = rand.Next(Terminals.Count); * randomComboList.Add(Terminals[randNode]); * } * * // Surprise * ComboNode node = ToComboNode(randomComboList); * * fixedBayes.CalculateSurprise(ref node, 1, out surprise_vec, out surprise, false); * * // update surprise * if (surprise > ihs) * ihs = surprise; * * // Calculate efficiency * fixedBayes.GenerateComboVector(ref node, out comboArray); * Instance target = new Instance(comboArray); * efficiency = fixedKNN.getKNearestWinrates(target, 5); * efficiency /= 100; * * // Calculate creativity * creativity = ((surprise / ihs) + efficiency) / 2; * * //-------------------------------------------------------------------------------------------------------------------------- * * // (ii)honing velho aleatorio * Dictionary<String, String> shcombolist = new Dictionary<String, String>(); * Dictionary<String, HoningNode<String>> honingOut; * List<String> bridges; * net.getMfList(seed, out bridges); * net.recruitNeurds(bridges, out honingOut, "terminal"); * * List<String> comboH = new List<string>(); * * int limit = combosize; * if(honingOut.Count < combosize) * limit = honingOut.Count; * for (int i = 0; i < limit; i++) * comboH.Add(honingOut.ElementAt(i).Key); * * // Surprise * node = ToComboNode(comboH); * * fixedBayes.CalculateSurprise(ref node, 1, out surprise_vec, out surprise, false); * * // update surprise * if (surprise > iihs) * iihs = surprise; * * // Calculate efficiency * fixedBayes.GenerateComboVector(ref node, out comboArray); * target = new Instance(comboArray); * efficiency = fixedKNN.getKNearestWinrates(target, 5); * efficiency /= 100; * * // Calculate creativity * creativity = ((surprise / iihs) + efficiency) / 2; * * //-------------------------------------------------------------------------------------------------------------------------- * * // (iii)honing novo aleatorio * HoningTest( * config, * fixedBayes, * fixedKNN, * mana, * combosize, * net, * cardTable, * seed, * op, * ExpansionGeneralPolitics.Random, * out combo, * out creativity, * out efficiency, * out surprise);*/ //-------------------------------------------------------------------------------------------------------------------------- // (iv)busca pela aresta com maior valor eficiência + surpresa (GULOSO) HoningTest( configGuided, fixedBayes, fixedKNN, mana, combosize, net, cardTable, seed, op, ExpansionGeneralPolitics.Weight, out combo, out creativity, out efficiency, out surprise); Console.WriteLine("Cluster honing finished runing."); //-------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------- // Surpresa dinâmica // (i)totalmente aleatorio (sem honing) // (ii)honing velho aleatorio // (iii)honing novo aleatorio // (iv)busca pela aresta com maior valor eficiência + surpresa //} } //} } }
void HoningTest( HSCardExpasionConfiguration config, HSHoningBayes fixedBayes, KNNEfficiency fixedKNN, int mana, int maxCards, HoningNetwork <String> net, Dictionary <String, CardObject> cardTable, String seed, HSCardOperator op, ExpansionGeneralPolitics pol, out List <String> combo, out double creativity, out double efficiency, out double surprise) { config.maxCards = maxCards; config.total_mana = mana; List <List <String> > out_subcluster; List <String> out_combo; op.GreedyExpansionDelegated( ref net, ref config, ref cardTable, pol, PriorityPolitics.Random, PriorityPolitics.Random, seed, out out_subcluster, out out_combo); // Context filter int voidCount = 0; for (int i = 0; i < out_combo.Count; i++) { if (out_combo[i] == "") { voidCount++; } } while (voidCount > 0) { out_combo.Remove(""); voidCount--; } // Surprise ComboNode comboNode = ToComboNode(out_combo); double[] surpriseVector; fixedBayes.CalculateSurprise(ref comboNode, 1, out surpriseVector, out surprise, true); // Calculate efficiency Double[] efficiencyVector; config.bayes.GenerateComboVector(ref comboNode, out efficiencyVector); Instance knnInstance = new Instance(efficiencyVector); efficiency = config.knn.getKNearestWinrates(knnInstance, 5); // Percent efficiency /= 100; // Calculate creativity creativity = ((surprise / config.highestSurprise) + efficiency) / 2; // Combo return combo = out_combo; }
public void PopulateFromHoningNetwork(ref HSDecksParser decks, ref Dictionary <String, CardObject> cardTable, int mana_mult) { combos_per_card = 10; combos_by_quantity = new Dictionary <string, Dictionary <int, List <ComboNode> > >(); // Hero loop foreach (String hero in decks.decks_by_hero.Keys) { // Decks loop foreach (HSDeckInfo deckinfo in decks.decks_by_hero[hero]) { // Generate honingNet for the deck HoningNetwork <String> deck_net = new HoningNetwork <string>(); List <CardObject> cards_objects = new List <CardObject>(); HoningStoneBuilder builder = new HoningStoneBuilder(); // Generate card table info to populate the honingNetwork foreach (String card in deckinfo.cards) { if (cardTable.ContainsKey(card)) { cards_objects.Add(cardTable[card]); } } builder.PopulateFromCardData(ref deck_net, ref cards_objects); builder.BuildThirdLevel(ref deck_net, ref cards_objects); // Generate all combos HSCardOperator op = new HSCardOperator(); HSCardExpasionConfiguration conf = new HSCardExpasionConfiguration(null, null); for (int j = 1; j < mana_mult; j++) { // Mana to spend on combo conf.total_mana = 10 * j; // Same deck insertion flag bool same_deck = false; foreach (String card in deckinfo.cards) { for (int i = 0; i < combos_per_card; i++) { List <List <String> > combo; List <String> sCombo; op.GreedyExpansionDelegated( ref deck_net, ref conf, ref cardTable, ExpansionGeneralPolitics.Random, PriorityPolitics.Random, PriorityPolitics.Random, card, out combo, out sCombo); // Create new combo object(Node) or get an existing one Dictionary <String, String> comboToFind = new Dictionary <string, string>(); foreach (String c in sCombo) { comboToFind.Add(c, c); } if (comboToFind.Count == 0) { continue; } ComboNode new_combo = FindCombo(ref comboToFind, hero); if (new_combo == null) { new_combo = new ComboNode(); if (!combos_by_quantity.ContainsKey(hero)) { combos_by_quantity.Add(hero, new Dictionary <int, List <ComboNode> >()); } if (!combos_by_quantity[hero].ContainsKey(comboToFind.Count)) { combos_by_quantity[hero].Add(comboToFind.Count, new List <ComboNode>()); } // Configura winrate for this combo float comboWinrate; float.TryParse(deckinfo.winrate, out comboWinrate); new_combo.winrates.Add(comboWinrate); new_combo.combo = comboToFind; // Add the combo to the master holder combos_by_quantity[hero][comboToFind.Count].Add(new_combo); } else { if (!same_deck && new_combo.combo.Count != 0) { float comboWinrate; float.TryParse(deckinfo.winrate, out comboWinrate); new_combo.winrates.Add(comboWinrate); } } same_deck = true; } } // end foreach card } // end for manda } // end foreach deck } // end foreach hero }
void ValidationTests(String cardsJson, String combosFile, int k) { HSCardsParser parser = new HSCardsParser(cardsJson); HoningStoneBuilder builder = new HoningStoneBuilder(); Dictionary <String, CardObject> cardTable = new Dictionary <string, CardObject>(); HSCardOperator op = new HSCardOperator(); HSCardsParser fullParser = new HSCardsParser("allCardsWithAbility.json", 0); Dictionary <String, int> dataID; Dictionary <String, double[]> cardDatasetFull = op.generateCardVectors(fullParser, out dataID); // Populate all card table foreach (string key in parser.objects.Keys) { List <CardObject> cards_objects = parser.objects[key]; builder.GenCardTableObject(ref cards_objects, ref cardTable); } HSCombosParser combosParser = new HSCombosParser(); //combosParser.PopulateFromHoningNetwork(ref decksParser, ref cardTable, 5); combosParser.PopulateFromJson(combosFile); Random rand = new Random(); List <CardObject> neutral = parser.objects["Neutral"]; foreach (String hero in parser.objects.Keys) { // To write results System.IO.StreamWriter file = new System.IO.StreamWriter(hero + "_results.dat"); if (hero != "Mage") { continue; } List <String> honingCombo; HoningNetwork <String> net = new HoningNetwork <string>(); List <CardObject> heroCards = parser.objects[hero]; builder.PopulateFromCardData(ref net, ref heroCards); builder.BuildThirdLevel(ref net, ref heroCards); builder.PopulateFromCardData(ref net, ref neutral); builder.BuildThirdLevel(ref net, ref neutral); HSHoningBayes fixedBayes = new HSHoningBayes(hero.ToLower(), ref combosParser, ref net, ref cardDatasetFull, ref cardTable, 100000); fixedBayes.SaveKNNDataset(hero + "_data.dataset"); Dataset fixedDataset = new Dataset(hero + "_data.dataset", ','); KNNEfficiency fixedKNN = new KNNEfficiency(fixedDataset); Dictionary <String, HoningNode <String> > dic = net.getNetwork(); Dictionary <String, String> selfAbilityFilter = op.GenerateAbilityFilter(); Dictionary <String, String> TerminalsDic = op.GetComboPotential(ref dic, ref cardTable, ref selfAbilityFilter, 123123); List <String> Terminals = TerminalsDic.Keys.ToList(); double[] surprise_vec; Double[] comboArray; // Tests i and ii control variables // Tests i, ii, iii, iv, v control variables int mana = 10; double surprise; double efficiency; double fitness; double creativity; double normCreativity; double normSurprise; double normEfficiency; List <String> combo = new List <string>(); double highSurp = 0.0; double minSurp = double.MaxValue; double highEff = 0.0; double minEff = double.MaxValue; // Tests i, ii, iii, iv, v control variables String seed = ""; // Calibrating surprise Console.WriteLine("----------------------------------------------------------------------"); Console.WriteLine("- Calibrating surprise! -"); for (int i = 0; i < 100; i++) { int totalMana = 0; List <String> randomComboList = new List <String>(); int manaCost = 0; while (totalMana < mana) { int randNode = rand.Next(Terminals.Count); Int32.TryParse(cardTable[Terminals[randNode]].cost, out manaCost); if (manaCost + totalMana <= mana) { randomComboList.Add(Terminals[randNode]); totalMana += manaCost; } } // Surprise ComboNode node = ToComboNode(randomComboList); fixedBayes.CalculateSurprise(ref node, 1, out surprise_vec, ref cardDatasetFull, out surprise, false); // Calculate efficiency fixedBayes.GenerateComboVector(ref node, ref cardDatasetFull, out comboArray); Instance target = new Instance(comboArray); efficiency = fixedKNN.getKNearestWinrates(target, k); if (surprise > highSurp) { highSurp = surprise; } if (surprise < minSurp) { minSurp = surprise; } if (efficiency > highEff) { highEff = efficiency; } if (efficiency < minEff) { minEff = efficiency; } } Console.WriteLine("- Surprise calibrated! -"); foreach (String c in Terminals) { Console.WriteLine("----------------------------------------------------------------------"); Console.WriteLine("Hero: " + hero); Console.WriteLine("Seed: " + c); Console.WriteLine(); file.WriteLine("----------------------------------------------------------------------"); file.WriteLine(); file.WriteLine("Hero: " + hero); file.WriteLine("Seed: " + c); // Test all reacheable seeds seed = c; //-------------------------------------------------------------------------------------------------------------------------- // (i)totalmente aleatorio (sem honing) int totalMana = 0; List <String> randomComboList = new List <String>(); randomComboList.Add(seed.ToLower()); int manaCost = 0; Int32.TryParse(cardTable[seed.ToLower()].cost, out manaCost); totalMana += manaCost; while (totalMana < mana) { int randNode = rand.Next(Terminals.Count); Int32.TryParse(cardTable[Terminals[randNode]].cost, out manaCost); if (manaCost + totalMana <= mana) { randomComboList.Add(Terminals[randNode]); totalMana += manaCost; } } // Surprise ComboNode node = ToComboNode(randomComboList); fixedBayes.CalculateSurprise(ref node, 1, out surprise_vec, ref cardDatasetFull, out surprise, false); // Calculate efficiency fixedBayes.GenerateComboVector(ref node, ref cardDatasetFull, out comboArray); Instance target = new Instance(comboArray); efficiency = fixedKNN.getKNearestWinrates(target, k); // Calculate creativity fitness = op.CalculateFitness(surprise, ref highSurp, ref minSurp, out normSurprise, ref highEff, ref minEff, out normEfficiency, efficiency); creativity = surprise + efficiency; normCreativity = normSurprise + normEfficiency; Console.WriteLine("Test I:\n"); Console.WriteLine("Fitness: " + fitness + "\nRaw creativity: " + creativity + "\nNormalized creativity: " + normCreativity + "\nSurprise " + surprise + "\nNormalized surprise: " + normSurprise + "\nEfficiency: " + efficiency + "\nNormalized efficiency: " + normEfficiency); Console.WriteLine("Highest surprise: " + highSurp + "\nLowest surprise: " + minSurp); Console.WriteLine("Highest efficiency: " + highEff + "\nLowest efficiency: " + minEff + "\n"); Console.WriteLine("Cards:\n"); file.WriteLine("Test I:\n"); file.WriteLine("Fitness: " + creativity + "\nRaw creativity: " + surprise + efficiency + "\nNormalized creativity: " + normEfficiency + normSurprise + "\nSurprise " + surprise + "\nNormalized surprise: " + normSurprise + "\nEfficiency: " + efficiency + "\nNormalized efficiency: " + normEfficiency); file.WriteLine("Highest surprise: " + highSurp + "\nLowest surprise: " + minSurp); file.WriteLine("Highest efficiency: " + highEff + "\nLowest efficiency: " + minEff + "\n"); file.WriteLine(); file.WriteLine("Cards: "); file.WriteLine(); foreach (String st in randomComboList) { Console.Write("(" + st + ") "); file.Write("(" + st + ") "); } Console.WriteLine("\n"); file.WriteLine("\n"); //-------------------------------------------------------------------------------------------------------------------------- // (ii)honing novo aleatorio honingCombo = op.GenerateCardClusterRandom( c, ref cardTable, ref net, ref selfAbilityFilter, ref fixedBayes, ref fixedKNN, ref cardDatasetFull, mana, k, ref highSurp, ref minSurp, ref highEff, ref minEff, out fitness, out surprise, out efficiency, out normSurprise, out normEfficiency).Keys.ToList(); creativity = surprise + efficiency; normCreativity = normSurprise + normEfficiency; Console.WriteLine("Test II:\n"); Console.WriteLine("Fitness: " + fitness + "\nRaw creativity: " + creativity + "\nNormalized creativity: " + normCreativity + "\nSurprise " + surprise + "\nNormalized surprise: " + normSurprise + "\nEfficiency: " + efficiency + "\nNormalized efficiency: " + normEfficiency); Console.WriteLine("Highest surprise: " + highSurp + "\nLowest surprise: " + minSurp); Console.WriteLine("Highest efficiency: " + highEff + "\nLowest efficiency: " + minEff + "\n"); Console.WriteLine("Cards:\n"); file.WriteLine("Test I:\n"); file.WriteLine("Fitness: " + creativity + "\nRaw creativity: " + surprise + efficiency + "\nNormalized creativity: " + normEfficiency + normSurprise + "\nSurprise " + surprise + "\nNormalized surprise: " + normSurprise + "\nEfficiency: " + efficiency + "\nNormalized efficiency: " + normEfficiency); file.WriteLine("Highest surprise: " + highSurp + "\nLowest surprise: " + minSurp); file.WriteLine("Highest efficiency: " + highEff + "\nLowest efficiency: " + minEff + "\n"); file.WriteLine(); file.WriteLine("Cards: "); file.WriteLine(); foreach (String st in honingCombo) { Console.Write("(" + st + ") "); file.Write("(" + st + ") "); } Console.WriteLine("\n"); file.WriteLine("\n"); //-------------------------------------------------------------------------------------------------------------------------- // (iii)honing novo (E+S) honingCombo = op.GenerateCardCluster( c, ref cardTable, ref net, ref selfAbilityFilter, ref fixedBayes, ref fixedKNN, ref cardDatasetFull, mana, k, ref highSurp, ref minSurp, ref highEff, ref minEff, out fitness, out surprise, out efficiency, out normSurprise, out normEfficiency).Keys.ToList(); creativity = surprise + efficiency; normCreativity = normSurprise + normEfficiency; Console.WriteLine("Test III:\n"); Console.WriteLine("Fitness: " + fitness + "\nRaw creativity: " + creativity + "\nNormalized creativity: " + normCreativity + "\nSurprise " + surprise + "\nNormalized surprise: " + normSurprise + "\nEfficiency: " + efficiency + "\nNormalized efficiency: " + normEfficiency); Console.WriteLine("Highest surprise: " + highSurp + "\nLowest surprise: " + minSurp); Console.WriteLine("Highest efficiency: " + highEff + "\nLowest efficiency: " + minEff + "\n"); Console.WriteLine("Cards:\n"); file.WriteLine("Test I:\n"); file.WriteLine("Fitness: " + creativity + "\nRaw creativity: " + surprise + efficiency + "\nNormalized creativity: " + normEfficiency + normSurprise + "\nSurprise " + surprise + "\nNormalized surprise: " + normSurprise + "\nEfficiency: " + efficiency + "\nNormalized efficiency: " + normEfficiency); file.WriteLine("Highest surprise: " + highSurp + "\nLowest surprise: " + minSurp); file.WriteLine("Highest efficiency: " + highEff + "\nLowest efficiency: " + minEff + "\n"); file.WriteLine(); file.WriteLine("Cards: "); file.WriteLine(); foreach (String st in honingCombo) { Console.Write("(" + st + ") "); file.Write("(" + st + ") "); } Console.WriteLine("\n"); file.WriteLine("\n"); } file.Close(); } }
public List <String> RecruitNeighbours( ref HoningNetwork <String> net, ref Dictionary <String, Dictionary <String, HoningNode <String> > > subcluster, ref HSCardExpasionConfiguration config, ref Dictionary <String, CardObject> cardTable, ref ExpansionGeneralPolitics politic, ref PriorityPolitics selectionPriorities, ref Dictionary <String, Boolean> markers, ref List <String> combo) { List <String> res = new List <string>(); if (subcluster.Count == 0) { return(res); } // Configurating expansion levels int upper_level_index = 0; if (config.max_upperLevel_to_expand < 0) { upper_level_index = -1; } else { Random rand = new Random(); switch (selectionPriorities) { case PriorityPolitics.Random: upper_level_index = rand.Next(subcluster.Count - 1); break; case PriorityPolitics.First: upper_level_index = 0; break; case PriorityPolitics.Last: upper_level_index = subcluster.Count - 1; break; case PriorityPolitics.HigherWeight: // NOT YET break; case PriorityPolitics.LowestWeight: // NOT YET break; case PriorityPolitics.MidWeight: // NOT YET break; } } Dictionary <String, Dictionary <String, HoningNode <String> > > workingspace = new Dictionary <string, Dictionary <string, HoningNode <string> > >(); if (upper_level_index < 0) { workingspace = subcluster; } else { workingspace.Add(subcluster.ElementAt(upper_level_index).Key, subcluster.ElementAt(upper_level_index).Value); } // Inflating solution foreach (String key in workingspace.Keys) { Dictionary <String, HoningNode <String> > dic = workingspace[key]; List <String> space = InflateNeighbours(dic, cardTable, config, politic, markers, combo); res.AddRange(space); } return(res); }
public HSCardCluster GenerateCardCluster(String seed, ref Dictionary <String, CardObject> cardTable, ref HoningNetwork <String> net) { String s = seed.ToLower(); if (!net.HasNode(s)) { return(null); } HSCardCluster cluster = new HSCardCluster(); cluster.card = seed; List <String> targets = new List <string>(); CardObject Antonidas = cardTable[s]; net.getMfList(s, out targets, "essential"); Dictionary <String, String> selfAbilityFilter = GenerateAbilityFilter(); foreach (CardAbility a in Antonidas.abilities) { if (selfAbilityFilter.ContainsKey(a.ability.ToLower())) { if (!cluster.receiver.ContainsKey(a.ability)) { Dictionary <String, HoningNode <String> > comboByTargets = GetCardsBySingleBound(ref net, a.target[0], "terminal"); cluster.receiver.Add(a.ability, comboByTargets); } } } Dictionary <String, HoningNode <String> > giverAbilities; net.GetRelationsFromEssential(s, out giverAbilities); FilterAbilities(ref selfAbilityFilter, ref giverAbilities); foreach (String key in giverAbilities.Keys) { Dictionary <String, HoningNode <String> > comboByTargets = GetCardsBySingleBound(ref net, key, "terminal"); RemoveUnwantedTargets(ref comboByTargets, ref cardTable, ref targets, key); cluster.giver.Add(key, comboByTargets); } return(cluster); }
void ValidationTests(String cardsJson, String combosFile, String knnDatase, int k) { HSCardsParser parser = new HSCardsParser(cardsJson); HoningStoneBuilder builder = new HoningStoneBuilder(); Dictionary <String, CardObject> cardTable = new Dictionary <string, CardObject>(); HSCardOperator op = new HSCardOperator(); // Populate all card table foreach (string key in parser.objects.Keys) { List <CardObject> cards_objects = parser.objects[key]; builder.GenCardTableObject(ref cards_objects, ref cardTable); } HSCombosParser combosParser = new HSCombosParser(); //combosParser.PopulateFromHoningNetwork(ref decksParser, ref cardTable, 5); combosParser.PopulateFromJson(combosFile); Random rand = new Random(); foreach (String hero in parser.objects.Keys) { // To write results System.IO.StreamWriter file = new System.IO.StreamWriter(hero + "_results.dat"); if (hero == "Neutral") { continue; } List <String> honingCombo; List <String> highestComboI = new List <String>(); List <String> highestComboII = new List <String>();; List <String> highestComboIII = new List <String>();; HoningNetwork <String> net = new HoningNetwork <string>(); List <CardObject> heroCards = parser.objects[hero]; List <CardObject> neutral = parser.objects["Neutral"]; builder.PopulateFromCardData(ref net, ref heroCards); builder.BuildThirdLevel(ref net, ref heroCards); builder.PopulateFromCardData(ref net, ref neutral); builder.BuildThirdLevel(ref net, ref neutral); HSHoningBayes fixedBayes = new HSHoningBayes(hero.ToLower(), ref combosParser, ref net, ref cardTable); //fixedBayes.SaveKNNDataset("ARSDataset.dataset"); Dataset fixedDataset = new Dataset(knnDatase, ','); KNNEfficiency fixedKNN = new KNNEfficiency(fixedDataset); HSHoningBayes dynamicBayes = new HSHoningBayes(hero.ToLower(), ref combosParser, ref net, ref cardTable); Dictionary <String, HoningNode <String> > dic = net.getNetwork(); Dictionary <String, String> selfAbilityFilter = op.GenerateAbilityFilter(); Dictionary <String, String> TerminalsDic = op.GetRealComboPotential(ref dic, ref cardTable, ref selfAbilityFilter, 3); List <String> Terminals = TerminalsDic.Keys.ToList(); double[] surprise_vec; Double[] comboArray; // Tests i and ii control variables // Tests i, ii, iii, iv, v control variables int mana = 10; double surprise; double efficiency; double creativity; List <String> combo = new List <string>(); // Tests i, ii, iii, iv, v control variables // Test I double highestCreativityA = 0.0; // Test II double highestCreativityB = 0.0; // Test III double highestCreativityC = 0.0; double highSurp = 0.0; double highestEfficience = 0.0; String seed = ""; foreach (String c in Terminals) { Console.WriteLine("Hero: " + hero); Console.WriteLine("Seed: " + c); file.WriteLine("Hero: " + hero); file.WriteLine("Seed: " + c); // Test all reacheable seeds seed = c; //-------------------------------------------------------------------------------------------------------------------------- // (i)totalmente aleatorio (sem honing) int totalMana = 0; List <String> randomComboList = new List <String>(); randomComboList.Add(seed.ToLower()); int manaCost = 0; Int32.TryParse(cardTable[seed.ToLower()].cost, out manaCost); totalMana += manaCost; while (totalMana < mana) { int randNode = rand.Next(Terminals.Count); Int32.TryParse(cardTable[Terminals[randNode]].cost, out manaCost); if (manaCost + totalMana <= mana) { randomComboList.Add(Terminals[randNode]); totalMana += manaCost; } } // Surprise ComboNode node = ToComboNode(randomComboList); fixedBayes.CalculateSurprise(ref node, 1, out surprise_vec, out surprise, false); // Calculate efficiency fixedBayes.GenerateComboVector(ref node, out comboArray); Instance target = new Instance(comboArray); efficiency = fixedKNN.getKNearestWinrates(target, k); efficiency /= 100; if (surprise > highSurp) { highSurp = surprise; } if (efficiency > highestEfficience) { highestEfficience = efficiency; } // Calculate creativity creativity = op.CalculateCreativity(surprise / highSurp, efficiency); // Write in file bool update = false; if (creativity > highestCreativityA) { highestCreativityA = creativity; update = true; } Console.WriteLine("I: " + creativity + " " + surprise / highSurp + " " + efficiency); file.WriteLine("I: " + creativity + " " + surprise + " " + efficiency); foreach (String st in randomComboList) { Console.Write(st + "|"); file.Write(st + "|"); if (update) { highestComboI.Add(st); } } Console.WriteLine(); file.WriteLine(); //-------------------------------------------------------------------------------------------------------------------------- // (ii)honing novo aleatorio honingCombo = op.GenerateCardClusterRandom(c, ref cardTable, ref net, ref selfAbilityFilter, ref fixedBayes, ref fixedKNN, mana, k, highSurp, out creativity, out surprise, out efficiency).Keys.ToList(); update = false; if (creativity > highestCreativityB) { highestCreativityB = creativity; update = true; } if (efficiency > highestEfficience) { highestEfficience = efficiency; } file.WriteLine("II: " + creativity + " " + surprise + " " + efficiency); Console.WriteLine("II: " + creativity + " " + surprise + " " + efficiency); foreach (String st in honingCombo) { Console.Write(st + "|"); file.Write(st + "|"); if (update) { highestComboI.Add(st); } } file.WriteLine(); Console.WriteLine(); //-------------------------------------------------------------------------------------------------------------------------- // (iii)honing novo (E+S) honingCombo = op.GenerateCardCluster(c, ref cardTable, ref net, ref selfAbilityFilter, ref fixedBayes, ref fixedKNN, mana, k, ref highSurp, out creativity, out surprise, out efficiency).Keys.ToList(); update = false; if (creativity > highestCreativityC) { highestCreativityC = creativity; update = true; } if (efficiency > highestEfficience) { highestEfficience = efficiency; } file.WriteLine("III: " + creativity + " " + surprise + " " + efficiency); Console.WriteLine("III: " + creativity + " " + surprise + " " + efficiency); foreach (String st in honingCombo) { Console.Write(st + "|"); file.Write(st + "|"); if (update) { highestComboI.Add(st); } } file.WriteLine(); Console.WriteLine(); Console.WriteLine("----------------------------------------------------------------"); } file.Close(); } }
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
void ValidationTests(String cardsJson, String combosFile, int k) { HSCardsParser parser = new HSCardsParser(cardsJson); HoningStoneBuilder builder = new HoningStoneBuilder(); Dictionary <String, CardObject> cardTable = new Dictionary <string, CardObject>(); HSCardOperator op = new HSCardOperator(); HSCardsParser fullParser = new HSCardsParser("allCardsWithAbility.json", 0); Dictionary <String, int> dataID; Dictionary <String, double[]> cardDatasetFull = op.generateCardVectors(fullParser, out dataID); // Populate all card table foreach (string key in parser.objects.Keys) { List <CardObject> cards_objects = parser.objects[key]; builder.GenCardTableObject(ref cards_objects, ref cardTable); } HSCombosParser combosParser = new HSCombosParser(); //combosParser.PopulateFromHoningNetwork(ref decksParser, ref cardTable, 5); combosParser.PopulateFromJson(combosFile); Random rand = new Random(); List <CardObject> neutral = parser.objects["Neutral"]; String currentDirectory = "results"; bool exists = System.IO.Directory.Exists(currentDirectory); if (!exists) { System.IO.Directory.CreateDirectory(currentDirectory); } // boxplot files System.IO.StreamWriter Fitness = new System.IO.StreamWriter(currentDirectory + "//fit.txt"); System.IO.StreamWriter Efficiency = new System.IO.StreamWriter(currentDirectory + "//eff.txt"); System.IO.StreamWriter Surprise = new System.IO.StreamWriter(currentDirectory + "//sur.txt"); System.IO.StreamWriter Creativity = new System.IO.StreamWriter(currentDirectory + "//crea.txt"); System.IO.StreamWriter fileNormEfficiency = new System.IO.StreamWriter(currentDirectory + "//norm_eff.txt"); System.IO.StreamWriter fileNormSurprise = new System.IO.StreamWriter(currentDirectory + "//norm_sur.txt"); System.IO.StreamWriter fileNormCreativity = new System.IO.StreamWriter(currentDirectory + "//norm_crea.txt"); Fitness.WriteLine("Hero Algorithm Value"); Efficiency.WriteLine("Hero Algorithm Value"); Surprise.WriteLine("Hero Algorithm Value"); Creativity.WriteLine("Hero Algorithm Value"); fileNormEfficiency.WriteLine("Hero Algorithm Value"); fileNormSurprise.WriteLine("Hero Algorithm Value"); fileNormCreativity.WriteLine("Hero Algorithm Value"); foreach (String hero in parser.objects.Keys) { if (hero == "Neutral") { continue; } List <String> honingCombo; HoningNetwork <String> net = new HoningNetwork <string>(); List <CardObject> heroCards = parser.objects[hero]; builder.PopulateFromCardData(ref net, ref heroCards); builder.BuildThirdLevel(ref net, ref heroCards); builder.PopulateFromCardData(ref net, ref neutral); builder.BuildThirdLevel(ref net, ref neutral); HSHoningBayes fixedBayes = new HSHoningBayes(hero.ToLower(), ref combosParser, ref net, ref cardDatasetFull, ref cardTable, 100000); fixedBayes.SaveKNNDataset(hero + "_data.dataset"); Dataset fixedDataset = new Dataset(hero + "_data.dataset", ','); KNNEfficiency fixedKNN = new KNNEfficiency(fixedDataset); Dictionary <String, HoningNode <String> > dic = net.getNetwork(); Dictionary <String, String> selfAbilityFilter = op.GenerateAbilityFilter(); Dictionary <String, String> TerminalsDic = op.GetComboPotential(ref dic, ref cardTable, ref selfAbilityFilter, 10); List <String> Terminals = TerminalsDic.Keys.ToList(); // Tests i, ii, iii, iv, v control variables int mana = 10; double surprise; double efficiency; double fitness; double creativity; double normCreativity; double normSurprise; double normEfficiency; List <String> combo = new List <string>(); double highSurp = 0.0; double minSurp = double.MaxValue; double highEff = 0.0; double minEff = double.MaxValue; // Tests i, ii, iii, iv, v control variables String seed = ""; Console.WriteLine("----------------------------------------------------------------------"); Console.WriteLine("- Loading calibrated surprise! -"); string[] lines = System.IO.File.ReadAllLines(hero + "_calibration.cal"); char[] delim = new char[1]; delim[0] = ' '; String highSurprise = lines[0].Split(delim).Last(); String minSurprise = lines[1].Split(delim).Last(); String highEfficiency = lines[2].Split(delim).Last(); String minEfficiency = lines[3].Split(delim).Last(); double.TryParse(highSurprise, out highSurp); double.TryParse(minSurprise, out minSurp); double.TryParse(highEfficiency, out highEff); double.TryParse(minEfficiency, out minEff); int seedCount = 1; int totalTestsPerSeed = 10; // Foreach percentage for (int percentage = 20; percentage <= 100; percentage += 20) { // To write results System.IO.StreamWriter resultFile = new System.IO.StreamWriter(currentDirectory + "//" + hero + "_results_II_" + percentage + ".dat"); // To calculate statistics List <result> listres = new List <result>(); foreach (String c in Terminals) { //String c = Terminals.First(); Console.WriteLine("----------------------------------------------------------------------"); Console.WriteLine("Hero: " + hero); Console.WriteLine("Seed: " + c); Console.WriteLine("Seed " + seedCount + " of " + Terminals.Count); Console.WriteLine(); // Test all reacheable seeds seed = c; for (int i = 0; i < totalTestsPerSeed; i++) { // (iii)honing novo (E+S) honingCombo = op.GenerateCardCluster( c, ref cardTable, ref net, ref selfAbilityFilter, ref fixedBayes, ref fixedKNN, ref cardDatasetFull, mana, k, percentage, false, ref highSurp, ref minSurp, ref highEff, ref minEff, out fitness, out surprise, out efficiency, out normSurprise, out normEfficiency).Keys.ToList(); creativity = surprise + efficiency; normCreativity = normSurprise + normEfficiency; result res = new result(honingCombo, fitness, creativity, normCreativity, surprise, normSurprise, efficiency, normEfficiency, highSurp, minSurp, highEff, minEff); listres.Add(res); } seedCount++; } // Renormalize and recalibrate limits List <result> renormalizedResults = renormalizeSimple(listres, ref highSurp, ref minSurp, ref minEff, ref highEff); // Write to file foreach (result r in renormalizedResults) { r.writeIntoFile(resultFile); } //extractViableSeeds(op, hero, 0, 1, meanFitness, meanEfficiency, meanSurprise, meanCreativity); writeForBoxPlot(hero, renormalizedResults, "II" + percentage, Fitness, Efficiency, Surprise, Creativity, fileNormEfficiency, fileNormSurprise, fileNormCreativity); resultFile.Close(); } // end statistics } // end hero // boxplot closing Fitness.Close(); Efficiency.Close(); Surprise.Close(); Creativity.Close(); fileNormCreativity.Close(); fileNormEfficiency.Close(); fileNormSurprise.Close(); }