• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 05:28
CET 11:28
KST 19:28
  • 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
HomeStory Cup 28 - Info & Preview12Rongyi Cup S3 - Preview & Info3herO wins SC2 All-Star Invitational14SC2 All-Star Invitational: Tournament Preview5RSL Revival - 2025 Season Finals Preview8
Community News
Weekly Cups (Jan 26-Feb 1): herO, Clem, ByuN, Classic win2RSL Season 4 announced for March-April6Weekly Cups (Jan 19-25): Bunny, Trigger, MaxPax win3Weekly Cups (Jan 12-18): herO, MaxPax, Solar win0BSL Season 2025 - Full Overview and Conclusion8
StarCraft 2
General
StarCraft 2 Not at the Esports World Cup 2026 Weekly Cups (Jan 26-Feb 1): herO, Clem, ByuN, Classic win HomeStory Cup 28 - Info & Preview Weekly Cups (Jan 19-25): Bunny, Trigger, MaxPax win Oliveira Would Have Returned If EWC Continued
Tourneys
PIG STY FESTIVAL 7.0! (19 Feb - 1 Mar) HomeStory Cup 28 StarCraft Evolution League (SC Evo Biweekly) RSL Season 4 announced for March-April $21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7)
Strategy
Custom Maps
[A] Starcraft Sound Mod
External Content
Mutation # 511 Temple of Rebirth The PondCast: SC2 News & Results Mutation # 510 Safety Violation Mutation # 509 Doomsday Report
Brood War
General
BW General Discussion Can someone share very abbreviated BW cliffnotes? [ASL21] Potential Map Candidates Liquipedia.net NEEDS editors for Brood War BGH Auto Balance -> http://bghmmr.eu/
Tourneys
Azhi's Colosseum - Season 2 [Megathread] Daily Proleagues Small VOD Thread 2.0 [BSL21] Non-Korean Championship - Starts Jan 10
Strategy
Zealot bombing is no longer popular? Simple Questions, Simple Answers Current Meta Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Nintendo Switch Thread Battle Aces/David Kim RTS Megathread Path of Exile Mobile Legends: Bang Bang Beyond All Reason
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 Vanilla Mini Mafia
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine European Politico-economics QA Mega-thread The Games Industry And ATVI Canadian Politics Mega-thread
Fan Clubs
The herO Fan Club! The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece
Sports
2024 - 2026 Football Thread
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Play, Watch, Drink: Esports …
TrAiDoS
My 2025 Magic: The Gathering…
DARKING
Life Update and thoughts.
FuDDx
How do archons sleep?
8882
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1520 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 1h 32m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
BRAT_OK 64
RotterdaM 1
ProTech1
StarCraft: Brood War
Bisu 1625
Jaedong 675
Light 497
Larva 360
Sacsri 269
BeSt 247
actioN 230
Dewaltoss 171
Mini 151
Sharp 123
[ Show more ]
ZergMaN 113
Pusan 92
Killer 84
Backho 68
sSak 67
ToSsGirL 60
Shuttle 58
Mong 50
Soma 47
Calm 47
Rush 45
hero 44
Hyuk 41
Mind 38
ZerO 33
zelot 30
Hm[arnc] 30
Bale 30
GoRush 21
Noble 19
ajuk12(nOOB) 18
Terrorterran 16
sorry 15
SilentControl 7
Movie 5
Dota 2
Gorgc2634
XaKoH 422
XcaliburYe68
Counter-Strike
shoxiejesuss961
Other Games
Liquid`RaSZi1060
ceh9506
crisheroes165
Pyrionflax162
Mew2King81
KnowMe46
ToD29
ZerO(Twitch)5
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• iopq 8
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos3667
• Stunt1718
Upcoming Events
WardiTV Invitational
1h 32m
Rex vs SHIN
Rex vs MaxPax
Rex vs ShoWTimE
SHIN vs ShoWTimE
MaxPax vs SHIN
MaxPax vs ShoWTimE
Replay Cast
13h 32m
The PondCast
23h 32m
WardiTV Invitational
1d 1h
Replay Cast
1d 13h
RongYI Cup
3 days
herO vs Maru
uThermal 2v2 Circuit
4 days
Replay Cast
4 days
Wardi Open
5 days
Monday Night Weeklies
5 days
[ Show More ]
Sparkling Tuna Cup
5 days
Liquipedia Results

Completed

Proleague 2026-02-02
HSC XXVIII
Underdog Cup #3

Ongoing

CSL 2025 WINTER (S19)
KCM Race Survival 2026 Season 1
Acropolis #4 - TS4
Rongyi Cup S3
Nations Cup 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8

Upcoming

Escore Tournament S1: W7
Escore Tournament S1: W8
Acropolis #4
IPSL Spring 2026
HSC XXIX
uThermal 2v2 2026 Main Event
Bellum Gens Elite Stara Zagora 2026
RSL Revival: Season 4
LiuLi Cup: 2025 Grand Finals
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League Season 23
ESL Pro League Season 23
PGL Cluj-Napoca 2026
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 © 2026 TLnet. All Rights Reserved.