Irinel Papuc

Irinel

About Me

Expertise
Generalist
Location
Not Specified
Website

Connect

Recent Forum Posts

SCRIPTING: Scripting text size won't change permanently Feb. 2, 2023, 7:15 a.m.

Sorry for the dumb question, but when I am changing the scripting text (zoom) size, it will always change it back to default. Is there any option to get that change permanently? Saving the current desktop doesn't help either.
Thanks a lot

Combinational sum in a given array Jan. 25, 2023, 11:49 a.m.

Thanks everyone for their help. If anyone is interested, I was finally able to wrap something up in vex though. In case it's useful for you, this is how it works (it is not perfect at all, but seems to get the job done):
float target = chi("target");
int array[] = {177, 167, 157, 147, 137, 127, 117, 107, 97, 87, 77, 67, 57, 47, 37, 27, 17, 7, 4, 3, 2, 1};
i[]@combination;

foreach(int item; array)
{
    if(target==0)
    {
        break;
    }
    if(item/target==1)
    {
        append(@combination, item);
        break;
    }
    if(item/target<1)
    {
        append(@combination, item);
        target = target-item;    
    }
}
The code requires that the target could be covered up by the items in the array. In this case it begins with the biggest item (due to sorting), tries to fit that in and if it does, it adds it to the combination, updates the target and moves on until the last bit of the target is reached.

Combinational sum in a given array Jan. 18, 2023, 7:48 p.m.

So, unfortunataly the permutations in python will only give me all unique rearrangements of my elements. It's also factorial. So when I am going to have, lets say 21 elements in my array, and I need the shortest combination to get a target sum, this will give me an unbearable amount of data, of which non of it might hold the right sum. In fact the sum will stay the same in each permutation, cause its "just" a rearrangement.

Maybe the "combinations_with_replacement" might be a better solution for that case and just working with a count as array length instead of a static one. That will give me at least every possible set, including using the same element more than once.

Will dig deeper in the "Backtracking/ Meet in the middle" approach as well, since it seems to provide much more control. Would be cool, if I can pull off a vex solution for that, but my monkey brain has its limitations I guess...