genetic

fitness function for rsi using genetic algorithms

让人想犯罪 __ 提交于 2021-01-20 13:39:06
问题 This code is implementing a fitness function for rsi indicators using genetic algorithms but i have no idea what are the output for every function def strategy_return(trading_signal, asset_return): strat_ret = np.array(trading_signal[0:-1]) * np.array(asset_return[1::]) strat_ret = np.insert(strat_ret, 0, np.nan) return strat_ret def _cumulative_return(ret): cum_ret_list = [ret[0]] n = ret.shape[0] for i in range(1, n): cum_ret = (1 + ret[i]) * (1 + cum_ret_list[-1]) - 1 cum_ret_list.append

Can i have a variable length chromosome in JGAP?

回眸只為那壹抹淺笑 提交于 2020-01-15 07:51:47
问题 Im using JGAP to generate testvectors for a schematic. I got maximum coverage of a single testvector by setting the genes of a chromosome to be bits . Now i need to get a 100% coverage with minimum number of testvectors. If i design each gene to be a testvector, id need to calculate a fitness function based on the number of genes and total coverage and id also need to evolve both chromosome length and each testvectors(genes) bits .. is it even possible to have a variable length chromosome?

How to Achieve Continuous Interactive Dialog with a Subprocess in Python? [duplicate]

僤鯓⒐⒋嵵緔 提交于 2019-12-25 01:49:59
问题 This question already has an answer here : Python subprocess and user interaction (1 answer) Closed 6 years ago . Maybe continuous interactive isn't the right phrase. I'm wondering if someone could help me understand the basics of calling a program as a subprocess from a Python program? I've been hacking away but I keep running into frustrating errors. I understand best using simple examples. I have a program called square.py saved to my desktop that uses the following code: i=0 while i<10: x

How to mix genetic algorithm with some heuristic

試著忘記壹切 提交于 2019-12-23 12:20:07
问题 I'm working on university scheduling problem and using simple genetic algorithm for this. Actually it works great and optimizes the objective function value for 1 hour from 0% to 90% (approx). But then the process getting slow down drammatically and it takes days to get the best solution. I saw a lot of papers that it is reasonable to mix other algos with genetiс one. Could you, please, give me some piece of advise of what algorithm can be mixed with genetic one and of how this algorithm can

counting sets of numbers in a long list

☆樱花仙子☆ 提交于 2019-12-12 17:08:31
问题 As I am new to python programming, I am having difficulty writing a python program. I am trying to count a set of seven objects(?) of three numbered digits and tabs within a long list. Then I need to find which set of numbers (in multiples of three's) have the maximum number along the list. The numbers are separated by a tab and the set of numbers are in seven's. For example: ['128','130','140','145','','','','283','379','','','','','','175','183','187','','','',''etc.] The first set of

Which is the best method between Genetic Algorithm and Dynamic Programming to solve classic 0-1 knapsack? [closed]

≡放荡痞女 提交于 2019-12-12 08:14:20
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . Let's say I have problem like this: Knapsack capacity = 20 million Number of item = 500 Weight of each item is random number between

Max Fitness stuck at local maxima in genetic algorithm implementation

限于喜欢 提交于 2019-12-12 03:39:46
问题 Having trouble with this code below. It is implementation of population evolution. In my case the max fitness is struck at a local maxima everytime and is unable to reach max possible value. Kindly suggest necessary edits and reason for the same. Individual.java package genetic.algorithm.project; import java.util.Random; public class Individual { public static int SIZE = 300; private int[] genes = new int[SIZE]; private double fitnessValue = 0.0; // Getters and Setters public void setGene(int

Differences between roulette wheel selection and rank based selection

我与影子孤独终老i 提交于 2019-12-10 20:57:11
问题 what are the differences between roulette wheel selection and rank based selection in genetic algorithm. i am confused which one is best for me now. that's why just want to know the differences. 回答1: The Rank Based Selection algorithm assigns probability(of them getting selected) to the items according to the priority they have. For example, the least priority item might get 10%, the one above that 20% and so on. In other words, the probability of an item getting selected is modified, and is

Which is the best method between Genetic Algorithm and Dynamic Programming to solve classic 0-1 knapsack? [closed]

▼魔方 西西 提交于 2019-12-03 17:04:06
Let's say I have problem like this: Knapsack capacity = 20 million Number of item = 500 Weight of each item is random number between 100 to 20 million Profit of each item is random number between 1 to 10 So which is the best method for my problem? GA or Dynamic Programming? Please give me a simple explanation, as I'm newbie in this.. Dynamic Programming (DP): Exact algorithm - Finds global optimal solution Long running time Uses a lot of memory Very simple to implement Genetic Algorithm (GA): Estimation - Doesn't necessarily find the global optimal solution Short running time Memory usage

Generating a random double between a range of values

半腔热情 提交于 2019-12-01 04:37:08
问题 Im currently having trouble generating random numbers between -32.768 and 32.768. It keeps giving me the same values but with a small change in the decimal field. ex : 27.xxx. Heres my code, any help would be appreciated. #include <iostream> #include <ctime> #include <cstdlib> using namespace std; int main() { srand( time(NULL) ); double r = (68.556*rand()/RAND_MAX - 32.768); cout << r << endl; return 0; } 回答1: I should mention if you're using a C++11 compiler, you can use something like this