Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Highlighted

08-23-2011 10:33 AM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

I have 32 sets of data with each set containing 4 data points. I am trying to come up with an eligant way to find a result that selects one data point from each set and meets the following constraints: 1) the overall difference between selected values in minimized; 2) the sum of all the values selected must be within a specified range.

Right now I'm not seeing a better way than simply running a whole bunch of nested loops (32) and index through all and compute the relative differences and sum the values. It is not pretty to look at by any means and I expect it will be very slow to compute.

Any suggestions?

Thanks.

Tim

Highlighted
Options

08-24-2011 04:00 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

hi tim ,

As per my understanding you can obtain the result by using just two loops and giving the output condition in a single loop. i can be more clear if you could build a program and send it. Meanwhile i will develop a VI and send you.

regards

bharath

Highlighted
Options

08-24-2011 05:59 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

hi tim,

please go through this VI and let me know if that is your requirement. i have assumed two data to be taken out.

Do revert for clarifications.

regards

bharath

Highlighted
Options

08-24-2011 11:23 AM - edited 08-24-2011 11:30 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Please see the simple example attached. It includes only 4 sets of data, each containing 3 data points. This is basically what I am looking to do but on a much larger scale.

I did try to run a 32 for loop VI yesterday and that method will definately take WAY too long to run, so I definately need to come up with an alternate solution.

Thank you for your help.

Tim

Highlighted
Options
So the end result is 32 data points (one from each of the 32 sets containing 4 points). The sum of the values must be within a specified range and the max and min values (difference) need to be minimized.

08-24-2011 11:57 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Highlighted
Options

08-24-2011 01:21 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi Tim,

It sounds as though you might be able to modify a least squares algorithm to select out a set of data points that would minimize the residual. The resulting fit could then be used to select out your datapoints meeting criteria (1), however this method would not necessarily insure that you satisfy criteria (2). You could then progressively remove large datapoints from the set and re-run the fitting routine until (2) is potentially met, however this might not necessarily lead to a "optimal" solution rather just a "reasonable" solution, or the dataset might not have a solution depending on the sum restriction.

May I ask what you are trying to achieve with this algorithm? I only ask that because there might be a pre-written algorithm to achieve such ends that would save you some time and insure a proper solution will be met.

Best,

Blayne Kettlewell

Highlighted
Options

08-24-2011 01:36 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

I am measuring the output from a 32 channel device. The '4 data points' from each channel are associated with 4 separate drive levels that each channel can be set to, for the given set of operating conditions. I have two constraints: The combined output must be within a specific range, but ideally at a set target. I must minimize variation between all 32 channels. I have a little wiggle room on the target, so I'm focusing on minimizing the variation as it is believed to be the cause of an issue we are investigating.

I will take a look at the Least Squares algorithm and see if I can figure out a way to make it work for our needs.

Thanks.

Tim