• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 00:47
CET 06:47
KST 14:47
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump1Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3
StarCraft 2
General
Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump Chinese SC2 server to reopen; live all-star event in Hangzhou Maestros of the Game: Live Finals Preview (RO4) BGE Stara Zagora 2026 announced Weekly Cups (Nov 24-30): MaxPax, Clem, herO win
Tourneys
2025 RSL Offline Finals Dates + Ticket Sales! Sparkling Tuna Cup - Weekly Open Tournament Tenacious Turtle Tussle StarCraft2.fi 15th Anniversary Cup RSL Offline Finals Info - Dec 13 and 14!
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 503 Fowl Play Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night
Brood War
General
[BSL21] RO8 Bracket & Prediction Contest BW General Discussion BGH Auto Balance -> http://bghmmr.eu/ Let's talk about Metropolis Foreign Brood War
Tourneys
[ASL20] Grand Finals Small VOD Thread 2.0 [Megathread] Daily Proleagues [BSL21] RO16 Group D - Sunday 21:00 CET
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates Current Meta Game Theory for Starcraft
Other Games
General Games
Stormgate/Frost Giant Megathread EVE Corporation Nintendo Switch Thread Path of Exile ZeroSpace Megathread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas Survivor II: The Amazon Sengoku Mafia TL Mafia Community Thread
Community
General
Things Aren’t Peaceful in Palestine US Politics Mega-thread Russo-Ukrainian War Thread YouTube Thread European Politico-economics QA Mega-thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece Movie Discussion!
Sports
Formula 1 Discussion 2024 - 2026 Football Thread
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
TL+ Announced Where to ask questions and add stream?
Blogs
Online gaming resear…
phantomlancer23
How Sleep Deprivation Affect…
TrAiDoS
I decided to write a webnov…
DjKniteX
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1424 users

Mathematica Help

Blogs > Dave[9]
Post a Reply
Dave[9]
Profile Blog Joined October 2003
United States2365 Posts
May 07 2009 04:04 GMT
#1
Hi guys!

So I'm doing a project on the Travelling Salesman Problem and thought that it would be easiest to do it through mathematica as it seems like I have the most programming experience through that program. Anyways, I'm pretty much done..except for one thing. I want my graph to display what the Distance the computer found!

Here's what I have so far..

+ Show Spoiler +


Manipulate[
With[{p = RandomInteger[10, {n, 2}]},
Graphics[{Line[p[[Last[FindShortestTour[p]]]]], PointSize[Large],
Red, Point[p]}]], {n, 1, 50, 1}]



I'll add a screenshot later, but in between my Manipulate function i want it to show the distance mathematica found to be the shortest. Any guesses?



*
http://www.teamliquid.net/forum/viewmessage.php?topic_id=104154&currentpage=316#6317
overpool
Profile Joined April 2008
United States191 Posts
Last Edited: 2009-05-07 04:20:21
May 07 2009 04:17 GMT
#2
Well, the first return value of FindShortestTour is the distance.

So do you want something like this?
+ Show Spoiler +

Manipulate[
Module[{p = RandomInteger[10, {n, 2}], tour},
tour = FindShortestTour[p];
Column[{
"Distance: " <> ToString@N[First@tour],
Graphics[
{Line[p[[Last[tour]]]], PointSize[Large], Red, Point[p]}]
}]

], {n, 1, 50, 1}]

yay i love tl events
]343[
Profile Blog Joined May 2008
United States10328 Posts
May 07 2009 07:02 GMT
#3
oh my, np-complete problems? perhaps I should learn to use mathematica
Writer
Dave[9]
Profile Blog Joined October 2003
United States2365 Posts
May 07 2009 09:24 GMT
#4
On May 07 2009 13:17 overpool wrote:
Well, the first return value of FindShortestTour is the distance.

So do you want something like this?
+ Show Spoiler +

Manipulate[
Module[{p = RandomInteger[10, {n, 2}], tour},
tour = FindShortestTour[p];
Column[{
"Distance: " <> ToString@N[First@tour],
Graphics[
{Line[p[[Last[tour]]]], PointSize[Large], Red, Point[p]}]
}]

], {n, 1, 50, 1}]



YES perfect, I didn't think about doing the return value first..
http://www.teamliquid.net/forum/viewmessage.php?topic_id=104154&currentpage=316#6317
BurntSynapse
Profile Joined September 2010
Chile1 Post
September 06 2010 12:29 GMT
#5
I'm looking for people who'd like to collaborate on linear programming models in Mathematica of SC2 for optimization solutions. I have a ludicrously expensive optimization book that's a few versions out of date, and rusty Mathematica and operations research skills, but its a project I've wanted to do for years.

Anyone else interested?
StructuredDream.blogspot.com
JodoYodo
Profile Blog Joined May 2009
Canada1772 Posts
September 06 2010 13:48 GMT
#6
You want to use LPs to solve SC2 optimization problems? Sounds like it'd be pretty intense. I'm an OR major, you can PM me and I'll see if I can help you formulate the problem, but I've never used Mathematica.
Dance dance dance 'till we run this town!
Please log in or register to reply.
Live Events Refresh
Next event in 6h 13m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RuFF_SC2 240
Nina 178
StarCraft: Brood War
Leta 715
910 285
Pusan 230
Hyun 167
Bale 48
Hm[arnc] 17
Icarus 9
Dota 2
monkeys_forever741
League of Legends
JimRising 699
C9.Mang0362
Cuddl3bear3
Other Games
summit1g11732
XaKoH 184
Livibee97
ViBE71
Trikslyr59
Organizations
Other Games
BasetradeTV36
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• practicex 24
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Diggity4
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Rush1593
• Lourlo1258
Other Games
• Shiphtur98
Upcoming Events
WardiTV 2025
6h 13m
Classic vs MaxPax
Solar vs Classic
ByuN vs Classic
ByuN vs Solar
Solar vs MaxPax
ByuN vs MaxPax
Big Brain Bouts
11h 13m
RSL Revival
22h 43m
StarCraft2.fi
1d 4h
IPSL
1d 11h
Sziky vs JDConan
OSC
1d 11h
Solar vs Percival
Gerald vs Nicoract
Creator vs ByuN
RSL Revival
1d 22h
Classic vs TBD
herO vs Zoun
WardiTV 2025
2 days
herO vs ShoWTimE
SHIN vs herO
Clem vs herO
SHIN vs Clem
SHIN vs ShoWTimE
Clem vs ShoWTimE
IPSL
2 days
Tarson vs DragOn
Wardi Open
3 days
[ Show More ]
Monday Night Weeklies
3 days
Replay Cast
3 days
Sparkling Tuna Cup
4 days
The PondCast
6 days
Liquipedia Results

Completed

Acropolis #4 - TS3
RSL Revival: Season 3
Kuram Kup

Ongoing

IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
Slon Tour Season 2
WardiTV 2025
META Madness #9
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Big Gabe Cup #3
RSL Offline Finals
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.