# stable marriage problem

I'm struggling to get the stable marriage problem solved in java. I have two arrays of point3d's and have a list of all the possible distances in rank order, but i can't get the algorithm to work. Can any1 help please
Cheers
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
0
Author Commented:
public void stableMarriage()
{
AvailableIndex [] startAvailableIndex = new AvailableIndex[start.length];
for(int b = 0; b < startAvailableIndex.length; b++)
{
startAvailableIndex[b] = new AvailableIndex();
}
while(!allPaired(startAvailableIndex))
{
System.out.println("in while loop");
//pick 1st unpaired
int i = 0;
for(i=0;i<start.length;i++)
{
if(startAvailableIndex[i].index() == -1)
{
break;
}

}
PointDist temp;
if(startAvailableIndex[i].index == -1)
{
temp = lists[i][0]; //get first choice
}
else
{
temp = lists[i][startAvailableIndex[i].index()];
}
startAvailableIndex[i].increment();
//remove lists[i][0] and shift then all down
System.out.println("temp "+temp.toString());
if(temp.available()==true)
{
System.out.println(temp.toString());
if(temp.dist() <= start [i].distance( end[startAvailableIndex[i].index()] )  )
{
//makePair(start[i],temp);
startAvailableIndex[i].available = false;
}
else
{
//remain unpaired
//startAvailableIndex[i] = -1;
}
}
}
for(int b = 0; b < startAvailableIndex.length; b++)
{
System.out.println(startAvailableIndex[b].index());
}
}

public boolean allPaired(AvailableIndex [] temp)
{
System.out.println("All paired");
for(int b = 0; b < temp.length; b++)
{
if(temp[b].available() == true)
{
return false;
}
}
return true;
}
0
Author Commented:
AvailableIndex is a class containing a boolean representing available, int (index) and float (distance)
0
Commented:
all you need to do is bosh
0
Author Commented:
0
Author Commented:
is it possible for me to do this problem or is another way needed?
0
Author Commented:
0
Commented:
0
Commented:
A request for refund has been made.  Experts you have 72 hours to respond.

danBosh,
I have seen many of your responses that say "all you need to do is bosh".  If you have nothing professional or constructive to add to a question, do not post.  This will be your only warning.

SpideyMod
Community Support Moderator @Experts Exchange
0
Commented:
Sorry SideyMod, n0152974 is my flatmate, and the comment was only a joke
0
Commented:
Sorry SideyMod, n0152974 is my flatmate, and the comment was only a joke
0
Commented:
danBosh,
Thanks for responding.

SpideyMod
Community Support Moderator @Experts Exchange
0
Commented:
PAQ'd and points refunded.

SpideyMod
Community Support Moderator @Experts Exchange
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.