Jump to content

n-Dimensional Array: Optimizing Eliminations


bsmither

Recommended Posts

I've been searching for a science that will solve this analysis problem. Since I don't know what I'm looking for, I cannot properly express the task to accomplish.

 

I have an eCommerce store selling a product that has (let's keep it simple) three properties and each property can hold any one of three possible relevant values (or null).

 

Combinations: 3^3=27

 

A typical combination would be round/solid/blue, or cubic/squishy/white.

 

The task is to efficiently eliminate that part of the array if any particular {set of values} is null. That is, if I currently have no pink items, the relevant sections of the array would get eliminated.

 

Product variations with low n-values is easy to manually handle. But with five and above, that's the math(?) theory I am trying to know the name of.

 

(I wonder if any Matlab manuals would give a clue.)

 

I am trying this elimination of sections of an established array instead of rebuilding the array every time a value is locked in.

 

On the other hand, maybe I'm trying to be too smart about this and should just let the server do the grunt work over and over.

Link to comment
Share on other sites

I'm wondering if you've given a complicated description of the following:

shapes   = { round, cubic, cylindrical }
textures = { solid, squishy }
colors   = { red, orange, yellow, green, blue, purple, black, white }

items = {
  { round, solid, blue },
  { cubic, squishy, white },
  { round, solid, orange },
  { round, solid, white }
}

unused shapes   = { round, cubic, cylindrical } - { round, cubic, round, round } = { cylindrical }
unused textures = { solid, squishy } - { solid, squishy, solid, solid } = { }
unused colors   = { red, orange, yellow, green, blue, purple, black, white } - { blue, white, orange, white } = { red, yellow, green, purple, black }
That's just a 2D array (1D is property, 2D is value) and you can get the "unused" values with array_diff. Edited by requinix
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.