<s>
In	O
optimization	O
,	O
3-opt	B-Algorithm
is	O
a	O
simple	O
local	B-Algorithm
search	I-Algorithm
algorithm	I-Algorithm
for	O
solving	O
the	O
travelling	B-Algorithm
salesperson	I-Algorithm
problem	I-Algorithm
and	O
related	O
network	O
optimization	O
problems	O
.	O
</s>
<s>
Compared	O
to	O
the	O
simpler	O
2-opt	B-Algorithm
algorithm	O
,	O
it	O
is	O
slower	O
but	O
can	O
generate	O
higher-quality	O
solutions	O
.	O
</s>
<s>
3-opt	B-Algorithm
analysis	O
involves	O
deleting	O
3	O
connections	O
(	O
or	O
edges	O
)	O
in	O
a	O
network	O
(	O
or	O
tour	O
)	O
,	O
to	O
create	O
3	O
sub-tours	O
.	O
</s>
<s>
A	O
single	O
execution	O
of	O
3-opt	B-Algorithm
has	O
a	O
time	O
complexity	O
of	O
.	O
</s>
<s>
Iterated	O
3-opt	B-Algorithm
has	O
a	O
higher	O
time	O
complexity	O
.	O
</s>
<s>
This	O
is	O
the	O
mechanism	O
by	O
which	O
the	O
3-opt	B-Algorithm
swap	O
manipulates	O
a	O
given	O
route:The	O
principle	O
is	O
pretty	O
simple	O
.	O
</s>
<s>
This	O
is	O
the	O
complete	O
3-opt	B-Algorithm
swap	O
making	O
use	O
of	O
the	O
above	O
mechanism:For	O
the	O
given	O
tour	O
,	O
you	O
generate	O
all	O
segments	O
combinations	O
and	O
for	O
each	O
combinations	O
,	O
you	O
try	O
to	O
improve	O
the	O
tour	O
by	O
reversing	O
segments	O
.	O
</s>
