I am looking for an algorithm to find the best dimension combination to accomplish a desired result.
Take the following as example:
| A | B | C | y |
|--------|--------|-------|-----|
| dog | house1 | green | 30 |
| dog | house1 | blue | 15 |
| cat | house1 | green | 20 |
| cat | house2 | red | 5 |
| turtle | house3 | green | 50 |
A, B, C are the measured dimensions. y is the measured result.
If I want to get all combinations of dimensions that accomplish y >= 50 so the results will be:
turtle, house3, green
turtle, any, green
turtle, house3, any
turtle, any, any
any, house3, green
any, house3, any
any, any, green
any, house1, green
any, house1, any
Maybe it's a easy problem but I was trying to figure an optimal solution in terms of O(n) and I didn't found it.
any, house1, any
a solution? Do you add the correspondingy
values, getting30 + 15 + 20 = 65
in that case? (Perhaps more background would be useful: what sort of quantity doesy
represent, and why does it make sense to be summing elements of they
column?) – Posthorsedistinct(A)
– Apiculture