Travelling salesman

M

m aslan

Hi everybody,

I have this matrix.

- X Y Z Q
X 0 5 3 2
Y 5 0 4 1
Z 3 4 0 6
Q 2 1 6 0

X,Y,Z,Q are citys, numbers are miles. example: X-Y: 5 mile

My code must generate 3 random route (ex: XQZY, XYZQ, QZYX) and find min route.


X-Q-Z-Y =2+6+4=12mile
Y-Q-Z-X =1+6+3=10mile
Q-Z-Y-X =6+4+5=15mile

Min route is Y-Q-Z-X =10mile

Can you help me?


Submitted via EggHeadCafe - Software Developer Portal of Choice
Join Lists with LINQ - SharePoint 2010
http://www.eggheadcafe.com/tutorial...6e-7d3fb7d38eca/join-lists-with-linq--sh.aspx
 
H

Harlan Messinger

m said:
Hi everybody,

I have this matrix.

- X Y Z Q
X 0 5 3 2
Y 5 0 4 1
Z 3 4 0 6
Q 2 1 6 0

X,Y,Z,Q are citys, numbers are miles. example: X-Y: 5 mile

My code must generate 3 random route (ex: XQZY, XYZQ, QZYX) and find min route.


X-Q-Z-Y =2+6+4=12mile
Y-Q-Z-X =1+6+3=10mile
Q-Z-Y-X =6+4+5=15mile

Min route is Y-Q-Z-X =10mile

Can you help me?

How far have you gotten? Where are you stuck? I'm supposing the teacher
has given you some idea of how to approach this.
 
A

Arne Vajhøj

I have this matrix.

- X Y Z Q
X 0 5 3 2
Y 5 0 4 1
Z 3 4 0 6
Q 2 1 6 0

X,Y,Z,Q are citys, numbers are miles. example: X-Y: 5 mile

My code must generate 3 random route (ex: XQZY, XYZQ, QZYX) and find min route.

X-Q-Z-Y =2+6+4=12mile
Y-Q-Z-X =1+6+3=10mile
Q-Z-Y-X =6+4+5=15mile

Min route is Y-Q-Z-X =10mile

Can you help me?

Have you studied the theory about this well known
problem?

I assume that you need to implement in C# since you are
asking in a C# group.

I suggest that you study the theory and try write the
implementation - and if you get into problems and it
in fact is C#, then you ask a more specific question here.

Most likely someone here will have a complete solution
on the shelf, but you do not learn much by getting that!

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top