Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB.NET
|
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 11th, 2006, 06:44 PM
Registered User
 
Join Date: Nov 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sorting data in to groups based on rules

Hi there, I’m wondering if anyone here could give me some help. Ive been stuck on this problem for weeks and im not getting any closer to solving it, so I hope someone here might be able to point me in the right direction!

I have to write a program to sort some data in to pairs, which normally would be quite simple, but unfortunaly its proving to be rather difficult.

The rules are:
There are 36 items. These items all have a colour and a class.
There are 4 catagorys, these catagorys contain pairs of items:
• Each item has to be in every category
• Each item can only be in a category once.
• An item cannot be paired with another item the same colour
• An item cannot be paired with another item in the came class
• An item can only be paired with another item once. So if item 2 is with item 36 in category one, they can never be together again.

Well, that’s quite easy to manage if each class was the same. But because the classes are uneven sizes, its proving very difficult to get them arranged. An example of the data is given below.



Class 1
    Item1 Yellow
    Item2 Green
    Item3 Yellow
    Item4 Green
    Item5 Yellow
    Item6 Green
Class2
    Item7 Green
    Item8 Yellow
    Item9 Green
    Item10 Yellow
Class 3
    Item11 Green
    Item12 Yellow
    Item13 Green
    Item14 Yellow
    Item15 Green
    Item16 Yellow
Class 4
    Item17 Green
    Item18 Yellow
    Item19 Green
    Item20 Yellow
    Item21 Green
    Item22 Yellow
    Item23 Green
    Item24 Yellow
Class 5
    Item25 Green
    Item26 Yellow
    Item27 Green
    Item28 Yellow
    Item29 Green
    Item30 Yellow
Class 6
    Item31 Green
    Item32 Yellow
    Item33 Green
    Item34 Yellow
    Item35 Green
    Item36 Yellow


Anyways, Thanks for you time, if you can think of anything that might help, please let me know!







Similar Threads
Thread Thread Starter Forum Replies Last Post
Pls help - Sorting based on condition kalwinhobbess Crystal Reports 0 September 10th, 2007 10:47 AM
sorting based on an index TheBFJ Excel VBA 4 November 21st, 2006 05:31 AM
sorting based on substring-before Kabe XSLT 1 October 14th, 2005 09:54 AM
Rules based on attribute values... jacob XML 2 July 6th, 2005 01:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.