Algorithm for combining ranges of a segment - help to create - page 3

 
Dmitry Fedoseev:

1. Where is the coefficient?

2. And p.1?

3. No, it's simpler than that. Okay, I'll try to speed it up tomorrow.

1. Coefficient (composite index) in each segment will be on its characteristics - experimentally then I determine the formula, but conventionally we can assume that he is.

2. So it is per segment separately, only one indicator (of the three on which it is calculated) there you can distribute to all, and the other two can not.

3. Thanks, I'll wait.

 

Here. But if there are 1,000 sections, it doesn't help. There are too many variants, you might not even have enough memory.

You can go another way - to the end of each segment bind an array with indexes pointing to the next segment. This way you can pass through all the options without filling the memory. But still there will be too many options... Searching will take a long time. Also you can think how to provide access to the variants by their numbers, if you need (for fun).

But is it really worth it, when there are so many variants? How about specifying the task to make it more realistic?

Files:
3.mq5  14 kb
 
Dmitry Fedoseev:

Here. But if there are 1,000 sections, it doesn't help. There are too many variants, you might not even have enough memory.

You can go another way - to the end of each segment bind an array with indexes pointing to the next segment. This way you can pass through all the options without filling the memory. But still there will be too many options... Searching will take a long time. Also you can think how to provide access to the variants by their numbers, if you need (for fun).

But is it really worth it, when there are so many variants? How about specifying the task to make it more realistic?

There could be many targets out there. The smallest misses, from the longest segments, from the shortest, from the most identical) even in target graphs the shortest time and the shortest path logistically are differently solved)
 
Valeriy Yastremskiy:
There can be a lot of targets there. The smallest misses, from the longest segments, from the shortest, from the most identical) even in target graphs less time and minimum path logistically are differently solved)

What is this about?

Arrays, with pointers to a neighbouring segment, are a paltry amount of memory compared to an array containing all the ready combinations.

 
Dmitry Fedoseev:

Here. But if there are 1,000 sections, it doesn't help. There are too many options, you might not even have enough memory.

Thank you!

But I'm not quite sure what the point of the update is - were corrections made to the code? Last time it retrieved 613 combinations, this time it retrieved 1507.

The speed has become slower, but that's probably from the number of combinations.

Last variant:

2021.04.23 19:56:08.350 Scripts script Q_Podbor_02 (Si-6.21,M1) loaded successfully
2021.04.23 19:56:08.742 Scripts script Q_Podbor_02 (Si-6.21,M1) removed

Current variant:

2021.04.23 19:51:56.608 Scripts script Q_Podbor_03 (Si-6.21,M1) loaded successfully
2021.04.23 19:51:58.387 Scripts script Q_Podbor_03 (Si-6.21,M1) removed
Dmitry Fedoseev:

We could go another way - to the end of each segment we could tie an array with indices pointing to the next segment. This ensures passing through all variants without filling up the memory. But still there will be a lot of variants... the search will take a long time. Also you can think how to provide access to the variants by their numbers, if you need (for fun).

If I got it right, the idea is to subsequently calculate the combination and evaluate it, then save the result and move on to the next combination. If new result (or top 10) is better than the last one, we replace it in array variable. And, yes, just wanted to ask, how to get the chain of indexes of the first level of the array of which the combination consists?

Dmitry Fedoseev:

But does it make sense if there are so many variants? How about specifying the problem to make it more realistic?

Why is the variant with limited number of segments from the current point (combination step, when n segments have already been picked up) not suitable, because it will significantly reduce the number of combinations?

 
Aleksey Vyazmikin:

Thank you!

But I didn't quite get the point of the update - were there corrections made to the code? Last time there were 613 combinations, this time there are 1507.

The speed has become slower, but that's probably from the number of combinations.

Last variant:

Current variant:

If I understood correctly, it is proposed to consecutively calculate a combination and immediately evaluate it, save the result of the evaluation and move on to the next combination. If new result (or top 10) is better than previous one, we replace it in array variable. And, yes, just wanted to ask, how to get a chain of first level indexes of the array of which the combination consists?

Why isn't it good to try a limited number of sections from the current point (step of combination, when you have already picked up n sections), because it allows to significantly reduce the number of combinations?

Why don't we consider the original version of the problem?

 
Алексей Тарабанов:

Why don't we look at the original version of the problem?

Without the segments.

 
Алексей Тарабанов:

Why don't we look at the original version of the problem?

Alexei Tarabanov:

Without the segments.

Was there such a variant?

The original variant is to ideally divide the numeric series as an array into segments (ranges). The criteria for splitting are:

1. At least 5% of numbers fall into a range - %R. 2;

2) Evaluate the response of a segment to another binary array of the same size (if there is a number in the range - 1, if not - 0) and the segment response should differ from the average value of the whole binary array by at least 5% - dP%;

3. on 10 identical segments by array depth, calculate SCO dP%, which should be not more than 1.5 - K_SKO.

Now different methods define ranges, but different methods are capable of selecting different ranges that meet the above criteria. Therefore, the goal is to take all of the breakdowns into segments from different methods and combine the best ones.

 
Aleksey Vyazmikin:

Thank you!

But I didn't quite get the point of the update - were there corrections made to the code? Last time there were 613 combinations, this time there are 1507.

The speed has become slower, but that's probably from the number of combinations.

Last variant:

Current variant:

If I understood correctly, it is proposed to consecutively calculate a combination and immediately evaluate it, save the result of the evaluation and move on to the next combination. If new result (or top 10) is better than previous one, we replace it in array variable. And, yes, just wanted to ask, how to get a chain of first level indexes of the array of which the combination consists?

Why isn't it good to try a limited number of sections from current point (step of combination, when you have already picked up n sections), because it allows to significantly reduce number of combinations?

And I don't know where and in what you are looking for combinations? Generally, with each start a new set of input segments is created and it is always different.

A chain of indices - so you need to create combinations not from the segments, but from the indices of the segments, or you can add a third element in the second dimension and store the index in it.

I don't know why some limited number is not suitable, you wrote about all combinations.

 
Dmitry Fedoseev:

I don't know where and in what combinations are you looking for?

Above, Alexei Tarabanov wrote in detail where and in what when answering. But this is theory - I haven't really finished what I need yet.

Dmitry Fedoseev:

Generally, each startup creates a new set of initial segments and they are always different.

Then I see - I haven't dealt with it and just run two scripts - if the set is different, then it will only be possible to evaluate if the sets are the same.

Dmitry Fedoseev:

Index chain - so we should create combinations not from segments, but from indexes of segments, well or add a third element to the second dimension and save the index into it.

I think the third element is a more convenient option. Could you tweak the code so that it works correctly with this implementation?

Dmitry Fedoseev:

I don't know why some sort of enumeration of some limited number is not good, you wrote about all combinations.

That's right, originally I wrote about all combinations, but in the process, thanks to you, it becomes clear that it's very expensive and you need an option, empirically capable of being no worse than brute force. And since evaluation of resulting segment is formed of its chunks, I assume, that by limiting n combinations of best chunks and adding new chunk, it will be possible to approach the best option of all possible combinations without limit.