I have two variables A
and B
, which both are 1x250 doubles.
Variables A
and B
are related to one another.
In other words, A(1)
and B(1)
are a pair (cause and effect).
A = [100, 1000, 254, 21,.....]
B = [-30, -100, -1254, -821,.....]
The problem is to find combinations in A
that can meet two conditions below
- sums of any combinations in
A
should be<= 500
- At the same time, sum of corresponding value in
B
should be less than-5000
I tried to use nchoosek
, but it really exploded after a few iterations due to the size of my variables.