Edit count of the user (user_editcount ) | null |
Name of the user account (user_name ) | '86.111.115.25' |
Age of the user account (user_age ) | 0 |
Groups (including implicit) the user is in (user_groups ) | [
0 => '*'
] |
Rights that the user has (user_rights ) | [
0 => 'createaccount',
1 => 'read',
2 => 'edit',
3 => 'createtalk',
4 => 'writeapi',
5 => 'viewmywatchlist',
6 => 'editmywatchlist',
7 => 'viewmyprivateinfo',
8 => 'editmyprivateinfo',
9 => 'editmyoptions',
10 => 'abusefilter-log-detail',
11 => 'centralauth-merge',
12 => 'abusefilter-view',
13 => 'abusefilter-log',
14 => 'vipsscaler-test'
] |
Whether the user is editing from mobile app (user_app ) | false |
Whether or not a user is editing through the mobile interface (user_mobile ) | false |
Page ID (page_id ) | 8818504 |
Page namespace (page_namespace ) | 0 |
Page title without namespace (page_title ) | '2-opt' |
Full page title (page_prefixedtitle ) | '2-opt' |
Last ten users to contribute to the page (page_recent_contributors ) | [
0 => 'Darragh OF',
1 => '144.212.3.4',
2 => 'Hasin abrar antu',
3 => 'Prosfilaes',
4 => '192.17.101.6',
5 => 'Marcocapelle',
6 => '103.14.185.112',
7 => '193.51.24.137',
8 => 'Mahveotm',
9 => '2A02:2C40:0:A001:5EF9:DDFF:FE74:C032'
] |
Action (action ) | 'edit' |
Edit summary/reason (summary ) | '' |
Old content model (old_content_model ) | 'wikitext' |
New content model (new_content_model ) | 'wikitext' |
Old page wikitext, before the edit (old_wikitext ) | '[[File:2-opt wiki.svg|thumb|2-opt]]
In [[Optimization (mathematics)|optimization]], '''2-opt''' is a simple local search algorithm first proposed by Croes in 1958 for solving the [[traveling salesman problem]]. The main idea behind it is to take a route that crosses over itself and reorder it so that it does not.
- A B - - A - B -
X ==>
- C D - - C - D -
A complete 2-opt local search will compare every possible valid combination of the swapping mechanism. This technique can be applied to the travelling salesman problem as well as many related problems. These include the [[vehicle routing problem]] (VRP) as well as the capacitated VRP, which require minor modification of the algorithm.
This is the mechanism by which the 2-opt swap manipulates a given route:
2optSwap(route, i, k) {
1. take route[0] to route[i-1] and add them in order to new_route
2. take route[i] to route[k] and add them in reverse order to new_route
3. take route[k+1] to end and add them in order to new_route
return new_route;
}
Here is an example of the above with arbitrary input:
example route: A ==> B ==> C ==> D ==> E ==> F ==> G ==> H ==> A
example i = 4, example k = 7 (starting index 1)
new_route:
1. (A ==> B ==> C)
2. A ==> B ==> C ==> (G ==> F ==> E ==> D)
3. A ==> B ==> C ==> G ==> F ==> E ==> D (==> H ==> A)
This is the complete 2-opt swap making use of the above mechanism:
repeat until no improvement is made {
start_again:
best_distance = calculateTotalDistance(existing_route)
for (i = 1; i < number of nodes eligible to be swapped - 1; i++) {
for (k = i + 1; k < number of nodes eligible to be swapped; k++) {
new_route = 2optSwap(existing_route, i, k)
new_distance = calculateTotalDistance(new_route)
if (new_distance < best_distance) {
existing_route = new_route
best_distance = new_distance
goto start_again
}
}
}
}
Note: If you start/end at a particular node or depot, then you must remove this from the search as an eligible candidate for swapping, as reversing the order will cause an invalid path.
For example, with depot at A:
A ==> B ==> C ==> D ==> A
Swapping using node[0] and node[2] would yield
C ==> B ==> A ==> D ==> A
which is not valid (does not leave from A, the depot).
==References==
* {{cite book|author = G. A. CROES | year = 1958 | title = A method for solving traveling salesman problems | publisher = Operations Res. 6 (1958) , pp., 791-812.}}
==See also==
*[[3-opt]]
*[[local search (optimization)]]
*[[Lin–Kernighan heuristic]]
==External links==
*[https://www.cs.ubc.ca/~hutter/previous-earg/EmpAlgReadingGroup/TSP-JohMcg97.pdf The Traveling Salesman Problem: A Case Study in Local Optimization]
*[http://www-e.uni-magdeburg.de/mertens/TSP/node3.html Improving Solutions: 2-opt Exchanges]
[[Category:Heuristic algorithms]]
[[Category:Travelling salesman problem]]' |
New page wikitext, after the edit (new_wikitext ) | '[[File:2-opt wiki.svg|thumb|2-opt]]
In [[Optimization (mathematics)|optimization]], '''2-opt''' is a simple local search algorithm first proposed by Croes in 1958 for solving the [[traveling salesman problem]]. The main idea behind it is to take a route that crosses over itself and reorder it so that it does not.lol
- A B - - A - B -
X ==>
- C D - - C - D -
A complete 2-opt local search will compare every possible valid combination of the swapping mechanism. This technique can be applied to the travelling salesman problem as well as many related problems. These include the [[vehicle routing problem]] (VRP) as well as the capacitated VRP, which require minor modification of the algorithm.
This is the mechanism by which the 2-opt swap manipulates a given route:
2optSwap(route, i, k) {
1. take route[0] to route[i-1] and add them in order to new_route
2. take route[i] to route[k] and add them in reverse order to new_route
3. take route[k+1] to end and add them in order to new_route
return new_route;
}
Here is an example of the above with arbitrary input:
example route: A ==> B ==> C ==> D ==> E ==> F ==> G ==> H ==> A
example i = 4, example k = 7 (starting index 1)
new_route:
1. (A ==> B ==> C)
2. A ==> B ==> C ==> (G ==> F ==> E ==> D)
3. A ==> B ==> C ==> G ==> F ==> E ==> D (==> H ==> A)
This is the complete 2-opt swap making use of the above mechanism:
repeat until no improvement is made {
start_again:
best_distance = calculateTotalDistance(existing_route)
for (i = 1; i < number of nodes eligible to be swapped - 1; i++) {
for (k = i + 1; k < number of nodes eligible to be swapped; k++) {
new_route = 2optSwap(existing_route, i, k)
new_distance = calculateTotalDistance(new_route)
if (new_distance < best_distance) {
existing_route = new_route
best_distance = new_distance
goto start_again
}
}
}
}
Note: If you start/end at a particular node or depot, then you must remove this from the search as an eligible candidate for swapping, as reversing the order will cause an invalid path.
For example, with depot at A:
A ==> B ==> C ==> D ==> A
Swapping using node[0] and node[2] would yield
C ==> B ==> A ==> D ==> A
which is not valid (does not leave from A, the depot).
==References==
* {{cite book|author = G. A. CROES | year = 1958 | title = A method for solving traveling salesman problems | publisher = Operations Res. 6 (1958) , pp., 791-812.}}
==See also==
*[[3-opt]]
*[[local search (optimization)]]
*[[Lin–Kernighan heuristic]]
==External links==
*[https://www.cs.ubc.ca/~hutter/previous-earg/EmpAlgReadingGroup/TSP-JohMcg97.pdf The Traveling Salesman Problem: A Case Study in Local Optimization]
*[http://www-e.uni-magdeburg.de/mertens/TSP/node3.html Improving Solutions: 2-opt Exchanges]
[[Category:Heuristic algorithms]]
[[Category:Travelling salesman problem]]' |
Unified diff of changes made by edit (edit_diff ) | '@@ -1,4 +1,4 @@
[[File:2-opt wiki.svg|thumb|2-opt]]
-In [[Optimization (mathematics)|optimization]], '''2-opt''' is a simple local search algorithm first proposed by Croes in 1958 for solving the [[traveling salesman problem]]. The main idea behind it is to take a route that crosses over itself and reorder it so that it does not.
+In [[Optimization (mathematics)|optimization]], '''2-opt''' is a simple local search algorithm first proposed by Croes in 1958 for solving the [[traveling salesman problem]]. The main idea behind it is to take a route that crosses over itself and reorder it so that it does not.lol
- A B - - A - B -
' |
New page size (new_size ) | 3142 |
Old page size (old_size ) | 3139 |
Size change in edit (edit_delta ) | 3 |
Lines added in edit (added_lines ) | [
0 => 'In [[Optimization (mathematics)|optimization]], '''2-opt''' is a simple local search algorithm first proposed by Croes in 1958 for solving the [[traveling salesman problem]]. The main idea behind it is to take a route that crosses over itself and reorder it so that it does not.lol'
] |
Lines removed in edit (removed_lines ) | [
0 => 'In [[Optimization (mathematics)|optimization]], '''2-opt''' is a simple local search algorithm first proposed by Croes in 1958 for solving the [[traveling salesman problem]]. The main idea behind it is to take a route that crosses over itself and reorder it so that it does not.'
] |
All external links added in the edit (added_links ) | [] |
All external links in the new text (all_links ) | [
0 => 'https://www.cs.ubc.ca/~hutter/previous-earg/EmpAlgReadingGroup/TSP-JohMcg97.pdf',
1 => 'http://www-e.uni-magdeburg.de/mertens/TSP/node3.html'
] |
Links in the page, before the edit (old_links ) | [
0 => 'http://www-e.uni-magdeburg.de/mertens/TSP/node3.html',
1 => 'https://www.cs.ubc.ca/~hutter/previous-earg/EmpAlgReadingGroup/TSP-JohMcg97.pdf'
] |
Whether or not the change was made through a Tor exit node (tor_exit_node ) | false |
Unix timestamp of change (timestamp ) | 1557048712 |