Composing an average stream piecewise
I have a list of `n` floating point streams each having a different size.  
The streams can be be composed together using the following rules:  
You can put a stream starting at any point in time (its zero before it started). You can use the same stream few times (it can overlap itself and even be in the same position few times) and you are allowed to not use a certain stream at all.  
e.g.:  
input streams:

    1 2 3 4
    2 4 5 6 7
    1 5 6

Can be composed like:

      1 2 3 4
    1 5 6
            1 5 6

After the placements an output stream is composed by the rule that each output float equals to the square root of the sum of the cube of each term.  
e.g.:  
If the streams at a position are:

    1
    2
    3

The output is:

    sqrt(1*1 + 2*2 + 3*3) = sqrt(14) = 3.74...

So for the the example composition:

      1 2 3 4
    1 5 6
            1 5 6
The output is:

    1 5.09 6.32 3 4.12 5 6

What I have is the output stream and the input streams. I need to compute the composition that lead to that output. an exact composition doesn't have to exists - I need a composition as close as possible to the output (smallest accumulated difference).  
e.g.:  
Input:  
Stream to mimic:

    1 5.09 6.32 3 4.12 5 6

and a list:

    1 2 3 4
    2 4 5 6 7
    1 5 6

Expected output:

    Stream 0 starting at 1,
    Stream 2 starting at 0,
    Stream 2 starting at 4.

This seems like an NP problem, is there any fast way to solve this? it can be somewhat brute force (but not totally, its not theoretic problem) and it can give not the best answer as long as its close enough.  

The algorithm will be usually used with stream to mimic with very long length (can be few megabytes) while it will have around 20 streams to be composed from, while each stream will be around kilobyte long.
Composing an average stream piecewise
===

I have a list of `n` floating point streams each having a different size.  
The streams can be be composed together using the following rules:  
You can put a stream starting at any point in time (its zero before it started). You can use the same stream few times (it can overlap itself and even be in the same position few times) and you are allowed to not use a certain stream at all.  
e.g.:  
input streams:

    1 2 3 4
    2 4 5 6 7
    1 5 6

Can be composed like:

      1 2 3 4
    1 5 6
            1 5 6

After the placements an output stream is composed by the rule that each output float equals to the square root of the sum of the cube of each term.  
e.g.:  
If the streams at a position are:

    1
    2
    3

The output is:

    sqrt(1*1 + 2*2 + 3*3) = sqrt(14) = 3.74...

So for the the example composition:

      1 2 3 4
    1 5 6
            1 5 6
The output is:

    1 5.09 6.32 3 4.12 5 6

What I have is the output stream and the input streams. I need to compute the composition that lead to that output. an exact composition doesn't have to exists - I need a composition as close as possible to the output (smallest accumulated difference).  
e.g.:  
Input:  
Stream to mimic:

    1 5.09 6.32 3 4.12 5 6

and a list:

    1 2 3 4
    2 4 5 6 7
    1 5 6

Expected output:

    Stream 0 starting at 1,
    Stream 2 starting at 0,
    Stream 2 starting at 4.

This seems like an NP problem, is there any fast way to solve this? it can be somewhat brute force (but not totally, its not theoretic problem) and it can give not the best answer as long as its close enough.  

The algorithm will be usually used with stream to mimic with very long length (can be few megabytes) while it will have around 20 streams to be composed from, while each stream will be around kilobyte long.