Ejemplo n.º 1
0
        public void InitPool(GPTemplate template)
        {
            this.template = template;

            while (solutions.Count < config.poolSize)
            {
                solutions.Add(template.CreateRandomSolution());
            }

            for (int i = 0; i < solutions.Count; i++)
            {
                solutions[i].template = template;
            }
        }
Ejemplo n.º 2
0
        public override GPTemplate CreateTemplate()
        {
            GPTemplate template = new GPTemplate(gpConfig);

            SemanticaList listaFormula            = definitions.GetListByName(GPConsts.LISTA_FORMULA);
            SemanticaList listaNumeros            = definitions.GetListByName(GPConsts.LISTA_NUMEROS);
            SemanticaList listaBooleanos          = definitions.GetListByName(GPConsts.LISTA_NUMEROS_BOOLEANOS);
            SemanticaList listaNumerosGrandes     = definitions.GetListByName(GPConsts.LISTA_NUMEROS_GRANDES);
            SemanticaList listaNumerosPercentuais = definitions.GetListByName(GPConsts.LISTA_NUMEROS_PERCENTUAIS);// 0 a 100

            //   template.AddProperty(PROP_COND_ENTRADA_C,)

            listFormulas.Add(PROP_COND_TARGET_SAIDA);
            template.AddProperty(PROP_COND_TARGET_SAIDA, listaNumerosPercentuais);
            if (config.flagCompra)
            {
                listFormulas.Add(PROP_COND_ENTRADA_C);
                listFormulas.Add(PROP_SIZING_C);
                listFormulas.Add(PROP_COND_SAIDA_C);
                listFormulas.Add(PROP_COND_STOP_MOVEL_C);
                listFormulas.Add(PROP_COND_STOP_INICIAL_C);
                template.AddProperty(PROP_COND_ENTRADA_C, listaFormula);
                template.AddProperty(PROP_SIZING_C, listaFormula);
                template.AddProperty(PROP_COND_SAIDA_C, listaFormula);
                template.AddProperty(PROP_COND_STOP_MOVEL_C, listaFormula);
                template.AddProperty(PROP_COND_STOP_INICIAL_C, listaFormula);
            }

            if (config.flagVenda)
            {
                listFormulas.Add(PROP_SIZING_V);

                listFormulas.Add(PROP_COND_ENTRADA_V);
                listFormulas.Add(PROP_COND_SAIDA_V);
                listFormulas.Add(PROP_COND_STOP_MOVEL_V);
                listFormulas.Add(PROP_COND_STOP_INICIAL_V);
                template.AddProperty(PROP_COND_ENTRADA_V, listaFormula);
                template.AddProperty(PROP_SIZING_V, listaFormula);
                template.AddProperty(PROP_COND_SAIDA_V, listaFormula);
                template.AddProperty(PROP_COND_STOP_MOVEL_V, listaFormula);
                template.AddProperty(PROP_COND_STOP_INICIAL_V, listaFormula);
            }


            listVariaveis.Add(Consts.VAR_STOP_GAP);
            listVariaveis.Add(Consts.VAR_RISCO_TRADE);
            listVariaveis.Add(Consts.VAR_STOP_MENSAL);
            listVariaveis.Add(Consts.VAR_MAX_CAPITAL_TRADE);
            listVariaveis.Add(Consts.VAR_PERC_TRADE);
            listVariaveis.Add(Consts.VAR_USA_STOP_MOVEL);
            listVariaveis.Add(Consts.VAR_RISCO_GLOBAL);
            listVariaveis.Add(Consts.VAR_MULTIPLAS_ENTRADAS);
            //   listVariaveis.Add(Consts.VAR_MULTIPLAS_SAIDAS);

            template.AddProperty(Consts.VAR_STOP_GAP, listaNumerosPercentuais);
            template.AddProperty(Consts.VAR_RISCO_TRADE, listaNumerosPercentuais);
            template.AddProperty(Consts.VAR_STOP_MENSAL, listaNumerosPercentuais);
            template.AddProperty(Consts.VAR_MAX_CAPITAL_TRADE, listaNumerosGrandes);
            template.AddProperty(Consts.VAR_PERC_TRADE, listaNumerosPercentuais);
            template.AddProperty(Consts.VAR_USA_STOP_MOVEL, listaBooleanos);
            template.AddProperty(Consts.VAR_RISCO_GLOBAL, listaNumerosPercentuais);
            template.AddProperty(Consts.VAR_MULTIPLAS_ENTRADAS, listaBooleanos);
            template.AddProperty(Consts.VAR_MULTIPLAS_SAIDAS, listaBooleanos);

            return(template);
        }