Commit 727b15ac by Stalin Munoz

algoritmos genéticos para TSP

parent 51b94bd1
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
\relax
\providecommand\hyper@newdestlabel[2]{}
\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument}
\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined
\global\let\oldcontentsline\contentsline
\gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}}
\global\let\oldnewlabel\newlabel
\gdef\newlabel#1#2{\newlabelxx{#1}#2}
\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}}
\AtEndDocument{\ifx\hyper@anchor\@undefined
\let\contentsline\oldcontentsline
\let\newlabel\oldnewlabel
\fi}
\fi}
\global\let\hyper@last\relax
\gdef\HyperFirstAtBeginDocument#1{#1}
\providecommand\HyField@AuxAddToFields[1]{}
\providecommand\HyField@AuxAddToCoFields[2]{}
\catcode `"\active
\catcode `<\active
\catcode `>\active
\@nameuse{es@quoting}
\@writefile{toc}{\beamer@endinputifotherversion {3.36pt}}
\@writefile{nav}{\beamer@endinputifotherversion {3.36pt}}
\select@language{spanish}
\@writefile{toc}{\select@language{spanish}}
\@writefile{lof}{\select@language{spanish}}
\@writefile{lot}{\select@language{spanish}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{1}{1/1}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {1}{1}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{2}{2/2}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {2}{2}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{3}{3/3}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {3}{3}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{4}{4/4}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {4}{4}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{5}{5/5}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {5}{5}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{6}{6/12}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {6}{12}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{7}{13/13}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {13}{13}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{8}{14/14}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {14}{14}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{9}{15/15}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {15}{15}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{10}{16/16}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {16}{16}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{11}{17/17}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {17}{17}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{12}{18/18}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {18}{18}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{13}{19/19}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {19}{19}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{14}{20/20}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {20}{20}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{15}{21/21}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {21}{21}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{16}{22/22}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {22}{22}}}
\@writefile{nav}{\headcommand {\beamer@partpages {1}{23}}}
\@writefile{nav}{\headcommand {\beamer@subsectionpages {1}{23}}}
\@writefile{nav}{\headcommand {\beamer@sectionpages {1}{23}}}
\@writefile{nav}{\headcommand {\beamer@documentpages {23}}}
\@writefile{nav}{\headcommand {\def \inserttotalframenumber {17}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{17}{23/23}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {23}{23}}}
\beamer@endinputifotherversion {3.36pt}
\headcommand {\slideentry {0}{0}{1}{1/1}{}{0}}
\headcommand {\beamer@framepages {1}{1}}
\headcommand {\slideentry {0}{0}{2}{2/2}{}{0}}
\headcommand {\beamer@framepages {2}{2}}
\headcommand {\slideentry {0}{0}{3}{3/3}{}{0}}
\headcommand {\beamer@framepages {3}{3}}
\headcommand {\slideentry {0}{0}{4}{4/4}{}{0}}
\headcommand {\beamer@framepages {4}{4}}
\headcommand {\slideentry {0}{0}{5}{5/5}{}{0}}
\headcommand {\beamer@framepages {5}{5}}
\headcommand {\slideentry {0}{0}{6}{6/12}{}{0}}
\headcommand {\beamer@framepages {6}{12}}
\headcommand {\slideentry {0}{0}{7}{13/13}{}{0}}
\headcommand {\beamer@framepages {13}{13}}
\headcommand {\slideentry {0}{0}{8}{14/14}{}{0}}
\headcommand {\beamer@framepages {14}{14}}
\headcommand {\slideentry {0}{0}{9}{15/15}{}{0}}
\headcommand {\beamer@framepages {15}{15}}
\headcommand {\slideentry {0}{0}{10}{16/16}{}{0}}
\headcommand {\beamer@framepages {16}{16}}
\headcommand {\slideentry {0}{0}{11}{17/17}{}{0}}
\headcommand {\beamer@framepages {17}{17}}
\headcommand {\slideentry {0}{0}{12}{18/18}{}{0}}
\headcommand {\beamer@framepages {18}{18}}
\headcommand {\slideentry {0}{0}{13}{19/19}{}{0}}
\headcommand {\beamer@framepages {19}{19}}
\headcommand {\slideentry {0}{0}{14}{20/20}{}{0}}
\headcommand {\beamer@framepages {20}{20}}
\headcommand {\slideentry {0}{0}{15}{21/21}{}{0}}
\headcommand {\beamer@framepages {21}{21}}
\headcommand {\slideentry {0}{0}{16}{22/22}{}{0}}
\headcommand {\beamer@framepages {22}{22}}
\headcommand {\beamer@partpages {1}{23}}
\headcommand {\beamer@subsectionpages {1}{23}}
\headcommand {\beamer@sectionpages {1}{23}}
\headcommand {\beamer@documentpages {23}}
\headcommand {\def \inserttotalframenumber {17}}
\headcommand {\slideentry {0}{0}{17}{23/23}{}{0}}
\headcommand {\beamer@framepages {23}{23}}
\beamer@endinputifotherversion {3.36pt}
\select@language {spanish}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd">
<!--Created by yEd 3.18.1-->
<key attr.name="Description" attr.type="string" for="graph" id="d0"/>
<key for="port" id="d1" yfiles.type="portgraphics"/>
<key for="port" id="d2" yfiles.type="portgeometry"/>
<key for="port" id="d3" yfiles.type="portuserdata"/>
<key attr.name="url" attr.type="string" for="node" id="d4"/>
<key attr.name="description" attr.type="string" for="node" id="d5"/>
<key for="node" id="d6" yfiles.type="nodegraphics"/>
<key for="graphml" id="d7" yfiles.type="resources"/>
<key attr.name="url" attr.type="string" for="edge" id="d8"/>
<key attr.name="description" attr.type="string" for="edge" id="d9"/>
<key for="edge" id="d10" yfiles.type="edgegraphics"/>
<graph edgedefault="directed" id="G">
<data key="d0"/>
<node id="n0">
<data key="d5"/>
<data key="d6">
<y:ShapeNode>
<y:Geometry height="30.0" width="30.0" x="21.0" y="111.67146672147132"/>
<y:Fill hasColor="false" transparent="false"/>
<y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.634765625" x="9.1826171875" xml:space="preserve" y="6.015625">1<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:Shape type="ellipse"/>
</y:ShapeNode>
</data>
</node>
<node id="n1">
<data key="d5"/>
<data key="d6">
<y:ShapeNode>
<y:Geometry height="30.0" width="30.0" x="20.99999999999998" y="21.0"/>
<y:Fill hasColor="false" transparent="false"/>
<y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.634765625" x="9.1826171875" xml:space="preserve" y="6.015625">2<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
<y:Shape type="ellipse"/>
</y:ShapeNode>
</data>
</node>
<edge id="e0" source="n0" target="n0">
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="-7.5" sy="15.0" tx="-15.0" ty="7.5">
<y:Point x="28.5" y="156.67146672147132"/>
<y:Point x="22.5" y="162.67146672147132"/>
<y:Point x="6.0" y="162.67146672147132"/>
<y:Point x="0.0" y="156.67146672147132"/>
<y:Point x="0.0" y="140.17146672147132"/>
<y:Point x="6.0" y="134.17146672147132"/>
</y:Path>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="none" target="standard"/>
<y:EdgeLabel alignment="center" configuration="AutoFlippingLabel" distance="2.0" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" preferredPlacement="anywhere" ratio="0.5" textColor="#000000" verticalTextPosition="bottom" visible="true" width="23.083984375" x="-55.25519562309643" xml:space="preserve" y="33.228832144372404">0.3<y:LabelModel><y:SmartEdgeLabelModel autoRotationEnabled="false" defaultAngle="0.0" defaultDistance="10.0"/></y:LabelModel><y:ModelParameter><y:SmartEdgeLabelModelParameter angle="0.0" distance="30.0" distanceToCenter="true" position="left" ratio="0.0" segment="3"/></y:ModelParameter><y:PreferredPlacementDescriptor angle="0.0" angleOffsetOnRightSide="0" angleReference="absolute" angleRotationOnRightSide="co" distance="-1.0" frozen="true" placement="anywhere" side="anywhere" sideReference="relative_to_edge_flow"/></y:EdgeLabel>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="e1" source="n1" target="n1">
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="7.5" sy="-15.0" tx="15.0" ty="-7.5">
<y:Point x="43.49999999999998" y="6.0"/>
<y:Point x="49.49999999999997" y="0.0"/>
<y:Point x="65.99999999999997" y="0.0"/>
<y:Point x="71.99999999999997" y="6.0"/>
<y:Point x="71.99999999999997" y="22.5"/>
<y:Point x="65.99999999999997" y="28.5"/>
</y:Path>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="none" target="standard"/>
<y:EdgeLabel alignment="center" configuration="AutoFlippingLabel" distance="2.0" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" preferredPlacement="anywhere" ratio="0.5" textColor="#000000" verticalTextPosition="bottom" visible="true" width="23.083984375" x="46.95800781249997" xml:space="preserve" y="-23.984375000000004">0.4<y:LabelModel><y:SmartEdgeLabelModel autoRotationEnabled="false" defaultAngle="0.0" defaultDistance="10.0"/></y:LabelModel><y:ModelParameter><y:SmartEdgeLabelModelParameter angle="0.0" distance="30.0" distanceToCenter="true" position="left" ratio="0.0" segment="-3"/></y:ModelParameter><y:PreferredPlacementDescriptor angle="0.0" angleOffsetOnRightSide="0" angleReference="absolute" angleRotationOnRightSide="co" distance="-1.0" frozen="true" placement="anywhere" side="anywhere" sideReference="relative_to_edge_flow"/></y:EdgeLabel>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="e2" source="n1" target="n0">
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="5.0" sy="0.0" tx="4.999999999999999" ty="0.0"/>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="none" target="standard"/>
<y:EdgeLabel alignment="center" configuration="AutoFlippingLabel" distance="2.0" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" preferredPlacement="anywhere" ratio="0.5" textColor="#000000" verticalTextPosition="bottom" visible="true" width="23.083984375" x="18.45800781249998" xml:space="preserve" y="22.22821611830402">0.6<y:LabelModel><y:SmartEdgeLabelModel autoRotationEnabled="false" defaultAngle="0.0" defaultDistance="10.0"/></y:LabelModel><y:ModelParameter><y:SmartEdgeLabelModelParameter angle="0.0" distance="30.0" distanceToCenter="true" position="left" ratio="0.5" segment="0"/></y:ModelParameter><y:PreferredPlacementDescriptor angle="0.0" angleOffsetOnRightSide="0" angleReference="absolute" angleRotationOnRightSide="co" distance="-1.0" frozen="true" placement="anywhere" side="anywhere" sideReference="relative_to_edge_flow"/></y:EdgeLabel>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="e3" source="n0" target="n1">
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="-5.0" sy="0.0" tx="-5.0" ty="0.0"/>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="none" target="standard"/>
<y:EdgeLabel alignment="center" configuration="AutoFlippingLabel" distance="2.0" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" preferredPlacement="anywhere" ratio="0.5" textColor="#000000" verticalTextPosition="bottom" visible="true" width="23.083984375" x="-41.54199218750001" xml:space="preserve" y="-40.19696622422528">0.7<y:LabelModel><y:SmartEdgeLabelModel autoRotationEnabled="false" defaultAngle="0.0" defaultDistance="10.0"/></y:LabelModel><y:ModelParameter><y:SmartEdgeLabelModelParameter angle="0.0" distance="30.0" distanceToCenter="true" position="left" ratio="0.5" segment="0"/></y:ModelParameter><y:PreferredPlacementDescriptor angle="0.0" angleOffsetOnRightSide="0" angleReference="absolute" angleRotationOnRightSide="co" distance="-1.0" frozen="true" placement="anywhere" side="anywhere" sideReference="relative_to_edge_flow"/></y:EdgeLabel>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
</graph>
<data key="d7">
<y:Resources/>
</data>
</graphml>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="73"
stroke-miterlimit="10"
font-weight="normal"
height="188.96088"
font-style="normal"
font-size="12px"
id="svg4228"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="ejemplo2estados.svg"
style="font-style:normal;font-weight:normal;font-size:12px;font-family:Dialog;color-interpolation:auto;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto">
<metadata
id="metadata4280">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1027"
id="namedview4278"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="3.7300885"
inkscape:cx="44"
inkscape:cy="81.208923"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="g4231" />
<!--Generated by ySVG 2.5-->
<defs
id="genericDefs" />
<g
id="g4231"
transform="translate(-41.5,-5.2480497)">
<defs
id="defs1">
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath1">
<path
d="M 0,0 171,0 171,226 0,226 0,0 Z"
id="path4235"
inkscape:connector-curvature="0" />
</clipPath>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath2">
<path
d="m -42,-18 171,0 0,226 -171,0 0,-226 z"
id="path4238"
inkscape:connector-curvature="0" />
</clipPath>
</defs>
<circle
style="fill:none;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
id="circle4246"
cy="126.6715"
cx="36"
clip-path="url(#clipPath2)"
r="15"
transform="translate(42,18)" />
<text
style="font-family:sans-serif;stroke:none;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
id="text4248"
clip-path="url(#clipPath2)"
y="130.82581"
xml:space="preserve"
x="32.182598"
transform="translate(42,18)">1</text>
<circle
style="fill:none;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
id="circle4250"
cy="36"
cx="36"
clip-path="url(#clipPath2)"
r="15"
transform="translate(42,18)" />
<text
style="font-family:sans-serif;stroke:none;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
id="text4252"
clip-path="url(#clipPath2)"
y="40.154301"
xml:space="preserve"
x="32.182598"
transform="translate(42,18)">2</text>
<path
style="fill:none;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
inkscape:connector-curvature="0"
id="path4254"
clip-path="url(#clipPath2)"
d="m 28.5,141.6715 0,15 -6,6 -16.5,0 -6,-6 0,-16.5 6,-6 7,0"
transform="translate(42,18)" />
<path
style="stroke:none;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
inkscape:connector-curvature="0"
id="path4256"
clip-path="url(#clipPath2)"
d="m 21,134.1715 -12,-5 3,5 -3,5 z"
transform="translate(42,18)" />
<text
style="font-family:sans-serif;stroke:none;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
id="text4258"
clip-path="url(#clipPath2)"
y="188.039"
xml:space="preserve"
x="-24.755199"
transform="translate(70,6)">0.3</text>
<path
style="fill:none;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
inkscape:connector-curvature="0"
id="path4260"
clip-path="url(#clipPath2)"
d="m 43.5,21 0,-15 6,-6 16.5,0 6,6 0,16.5 -6,6 -7,0"
transform="translate(42,18)" />
<path
style="stroke:none;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
inkscape:connector-curvature="0"
id="path4262"
clip-path="url(#clipPath2)"
d="m 51,28.5 12,5 -3,-5 3,-5 z"
transform="translate(42,18)" />
<text
style="font-family:sans-serif;stroke:none;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
id="text4264"
clip-path="url(#clipPath2)"
y="10.1543"
xml:space="preserve"
x="92.458"
transform="translate(-2,4)">0.4</text>
<path
style="fill:none;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
inkscape:connector-curvature="0"
id="path4266"
clip-path="url(#clipPath2)"
d="M 31,112.5483 31,58.1659"
transform="translate(42,18)" />
<path
style="stroke:none;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
inkscape:connector-curvature="0"
id="path4268"
clip-path="url(#clipPath2)"
d="m 31,50.1659 -5,12 5,-3 5,3 z"
transform="translate(42,18)" />
<text
style="font-family:sans-serif;stroke:none;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
id="text4270"
clip-path="url(#clipPath2)"
y="85.489998"
xml:space="preserve"
x="-8.5419998"
transform="translate(56,18)">0.7</text>
<path
style="fill:none;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
inkscape:connector-curvature="0"
id="path4272"
clip-path="url(#clipPath2)"
d="m 41,50.1231 0,54.3824"
transform="translate(42,18)" />
<path
style="stroke:none;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
inkscape:connector-curvature="0"
id="path4274"
clip-path="url(#clipPath2)"
d="m 41,112.5055 5,-12 -5,3 -5,-3 z"
transform="translate(42,18)" />
<text
style="font-family:sans-serif;stroke:none;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
id="text4276"
clip-path="url(#clipPath2)"
y="85.489998"
xml:space="preserve"
x="61.458"
transform="translate(26,18)">0.6</text>
</g>
</svg>
<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill-opacity="1" color-rendering="auto" color-interpolation="auto" text-rendering="auto" stroke="black" stroke-linecap="square" width="231" stroke-miterlimit="10" shape-rendering="auto" stroke-opacity="1" fill="black" stroke-dasharray="none" font-weight="normal" stroke-width="1" height="210" font-family="'Dialog'" font-style="normal" stroke-linejoin="miter" font-size="12px" stroke-dashoffset="0" image-rendering="auto">
<!--Generated by ySVG 2.5-->
<defs id="genericDefs"/>
<g>
<defs id="defs1">
<clipPath clipPathUnits="userSpaceOnUse" id="clipPath1">
<path d="M0 0 L231 0 L231 210 L0 210 L0 0 Z"/>
</clipPath>
<clipPath clipPathUnits="userSpaceOnUse" id="clipPath2">
<path d="M-15 -15 L216 -15 L216 195 L-15 195 L-15 -15 Z"/>
</clipPath>
</defs>
<g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="translate(15,15)" stroke="white">
<rect x="-15" width="231" height="210" y="-15" clip-path="url(#clipPath2)" stroke="none"/>
</g>
<g text-rendering="geometricPrecision" stroke-miterlimit="1.45" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,15,15)" stroke-linecap="butt">
<circle fill="none" r="15" clip-path="url(#clipPath2)" cx="36" cy="36"/>
<text x="32.3232" xml:space="preserve" y="40.1543" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none">a</text>
<circle fill="none" r="15" clip-path="url(#clipPath2)" cx="164.2288" cy="164.2288"/>
<text x="160.4202" xml:space="preserve" y="168.3831" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none">b</text>
<circle fill="none" r="15" clip-path="url(#clipPath2)" cx="164.2288" cy="36"/>
<text x="160.93" xml:space="preserve" y="40.1543" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none">c</text>
<circle fill="none" r="15" clip-path="url(#clipPath2)" cx="36" cy="164.2288"/>
<text x="32.1914" xml:space="preserve" y="168.3831" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none">d</text>
<path fill="none" d="M28.5 21 L28.5 6 L22.5 0 L6 0 L0 6 L0 22.5 L6 28.5 L13 28.5" clip-path="url(#clipPath2)"/>
<path d="M21 28.5 L9 23.5 L12 28.5 L9 33.5 Z" clip-path="url(#clipPath2)" stroke="none"/>
<path fill="none" d="M171.7288 149.2288 L171.7288 134.2288 L177.7288 128.2288 L194.2288 128.2288 L200.2288 134.2288 L200.2288 150.7288 L194.2288 156.7288 L187.2288 156.7288" clip-path="url(#clipPath2)"/>
<path d="M179.2288 156.7288 L191.2288 161.7288 L188.2288 156.7288 L191.2288 151.7288 Z" clip-path="url(#clipPath2)" stroke="none"/>
<path fill="none" d="M50.3068 31.5 L141.9051 31.5" clip-path="url(#clipPath2)"/>
<path d="M149.9051 31.5 L137.9051 26.5 L140.9051 31.5 L137.9051 36.5 Z" clip-path="url(#clipPath2)" stroke="none"/>
<path fill="none" d="M164.2288 149.2288 L164.2288 53" clip-path="url(#clipPath2)"/>
<path d="M159.2288 53 L169.2288 53 Z" clip-path="url(#clipPath2)" stroke="none"/>
<path fill="none" stroke-miterlimit="10" d="M159.2288 53 L169.2288 53 Z" clip-path="url(#clipPath2)" stroke-linecap="square"/>
<path fill="none" d="M171.7288 21 L171.7288 6 L177.7288 0 L194.2288 0 L200.2288 6 L200.2288 22.5 L194.2288 28.5 L187.2288 28.5" clip-path="url(#clipPath2)"/>
<path d="M179.2288 28.5 L191.2288 33.5 L188.2288 28.5 L191.2288 23.5 Z" clip-path="url(#clipPath2)" stroke="none"/>
<path fill="none" d="M149.922 40.5 L58.3237 40.5" clip-path="url(#clipPath2)"/>
<path d="M50.3237 40.5 L62.3237 45.5 L59.3237 40.5 L62.3237 35.5 Z" clip-path="url(#clipPath2)" stroke="none"/>
<path fill="none" d="M36 51 L36 147.2288" clip-path="url(#clipPath2)"/>
<path d="M41 147.2288 L31 147.2288 Z" clip-path="url(#clipPath2)" stroke="none"/>
<path fill="none" stroke-miterlimit="10" d="M41 147.2288 L31 147.2288 Z" clip-path="url(#clipPath2)" stroke-linecap="square"/>
<path fill="none" d="M150.1099 169.2288 L58.1244 169.2288" clip-path="url(#clipPath2)"/>
<path d="M50.1244 169.2288 L62.1244 174.2288 L59.1244 169.2288 L62.1244 164.2288 Z" clip-path="url(#clipPath2)" stroke="none"/>
<path fill="none" d="M28.5 149.2288 L28.5 134.2288 L22.5 128.2288 L6 128.2288 L0 134.2288 L0 150.7288 L6 156.7288 L13 156.7288" clip-path="url(#clipPath2)"/>
<path d="M21 156.7288 L9 151.7288 L12 156.7288 L9 161.7288 Z" clip-path="url(#clipPath2)" stroke="none"/>
<path fill="none" d="M50.1189 159.2288 L142.1044 159.2288" clip-path="url(#clipPath2)"/>
<path d="M150.1044 159.2288 L138.1044 154.2288 L141.1044 159.2288 L138.1044 164.2288 Z" clip-path="url(#clipPath2)" stroke="none"/>
</g>
</g>
</svg>
This source diff could not be displayed because it is too large. You can view the blob instead.
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex 2017.8.31) 20 AUG 2018 19:13
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex 2017.8.31) 6 NOV 2018 12:31
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
......@@ -1104,7 +1104,7 @@ Underfull \hbox (badness 10000) in paragraph at lines 259--259
[]
Overfull \hbox (15.5949pt too wide) in paragraph at lines 259--259
Overfull \hbox (4.73363pt too wide) in paragraph at lines 259--259
[] []$
[]
......@@ -1455,7 +1455,7 @@ pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy6.pfb></u
sr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy7.pfb></usr/shar
e/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy8.pfb></usr/share/texli
ve/texmf-dist/fonts/type1/public/amsfonts/symbols/msam10.pfb>
Output written on mdps.pdf (54 pages, 2015951 bytes).
Output written on mdps.pdf (54 pages, 2015958 bytes).
PDF statistics:
4314 PDF objects out of 5155 (max. 8388607)
3255 compressed objects within 33 object streams
......
No preview for this file type
No preview for this file type
......@@ -243,7 +243,7 @@ En lo que trataremos asumimos que el agente actua en forma racional.
Para el estado $s$ tenemos que el valor esperado de utilidad es: \\
\begin{center}
$\sum\limits_{s'} {P(S^{t+1}{=}s' \mid S^{t+1}{=}s) V(s')}$
$\sum\limits_{s'} {P(S^{t+1}{=}s' \mid S^{t}{=}s) V(s')}$
\end{center}
\note{
Recordemos que para una loteria podemos calcular su utilidad sumando los productos de las utilidades de las salidas con su probabilidad respectiva.
......@@ -263,7 +263,7 @@ Aquí el valor de utilidad $V(s)$ no será la recompensa instantanea sino la utili
\begin{itemize}
\item La utilidad {\color{blue}\emph{horizonte infinito}} considera la recompensa instantanea y el valor esperado de recompensa para tiempos futuros con su factor de descuento:\\
\begin{center}
$V(s) = R(s) + \gamma \sum\limits_{s'} {P(S^{t+1}{=}s' \mid S^{t+1}{=}s) V(s')}$
$V(s) = R(s) + \gamma \sum\limits_{s'} {P(S^{t+1}{=}s' \mid S^{t}{=}s) V(s')}$
\end{center}
\item Matricialmente:\\
\begin{center}
......
This diff is collapsed. Click to expand it.
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Cadenas de Markov"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Descripción.\n",
"![Cadena de Markov](\"markov.png\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Cadenas de Markov"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Descripción.\n",
"![Cadena de Markov](markov.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Matriz de probabilidades de transición"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[ 0.4 0.1]\n",
" [ 0.6 0.9]]\n"
]
}
],
"source": [
"import numpy as np\n",
"\n",
"# define la matriz de probabilidades de transición\n",
"# utilizando el paquete de cómputo científico de Python numpy\n",
"\n",
"#A = | p(d|d), p(b|d), p(c|d) |\n",
"# | p(b|d), p(b|b), p(c|b) |\n",
"# | p(c|d), p(b|c), p(c|c) |\n",
"\n",
"# por ejemplo la matriz\n",
"#A = | 0.4, 0.1|\n",
"# | 0.6, 0.9|\n",
"# puede definirse en python como\n",
"A = np.matrix([[0.4,0.1],[0.6,0.9]])\n",
"\n",
"print(A)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Encontrar la distribución de probabilidad estacionaria elevando a un exponente grande"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[ 0.14285714 0.14285714]\n",
" [ 0.85714286 0.85714286]]\n",
"[[ 0.14285714 0.14285714]\n",
" [ 0.85714286 0.85714286]]\n"
]
}
],
"source": [
"B = np.linalg.matrix_power(A,50)\n",
"print(B)\n",
"B = np.linalg.matrix_power(A,100)\n",
"print(B)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Encontrar la misma distribución calculando los eigenvectores"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [],
"source": [
"w,v = np.linalg.eig(A)"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[ 0.3 1. ]\n",
"[[-0.70710678 -0.16439899]\n",
" [ 0.70710678 -0.98639392]]\n"
]
}
],
"source": [
"print(w)\n",
"print(v)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"matrix([[ 0.14285714],\n",
" [ 0.85714286]])"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"v[:,1]/sum(v[:,1])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
......@@ -4,5 +4,5 @@ Satisfiable:
(p | q | r | s) & (~p | q | ~r) & (~q | ~r | s) & (p | ~q | r | s) & (q | ~r | ~s) & (~p | ~r | s) & (~p | ~s) & (p | ~q)
Unsatisfiable:
(__Z__21|__R__NEG__v1__v2)&(__Z__21|(__Z__22|v2__0)&(__Z__21|(__Z__22|~v2__2)&(__Z__21|(~__Z__22|v2__1)&(__Z__21|(~__Z__22|~v2__3)&(~__Z__21|~__R__NEG__v1__v2)&(~__Z__21|(~v2__0|v2__2)&(~__Z__21|(~v2__1|v2__3)&(__Z__23|__R__POS__v1__v2)&(__Z__23|(__Z__24|~v2__0)&(__Z__23|(__Z__24|v2__2)&(__Z__23|(~__Z__24|~v2__1)&(__Z__23|(~__Z__24|v2__3)&(~__Z__23|~__R__POS__v1__v2)&(~__Z__23|(v2__0|~v2__2)&(~__Z__23|(v2__1|~v2__3)&(__R__POS__v1__v2&~__R__NEG__v1__v2)&(__Z__25|__R__NEG__v1__v3)&(__Z__25|(__Z__26|v3__0)&(__Z__25|(__Z__26|~v3__2)&(__Z__25|(~__Z__26|v3__1)&(__Z__25|(~__Z__26|~v3__3)&(~__Z__25|~__R__NEG__v1__v3)&(~__Z__25|(~v3__0|v3__2)&(~__Z__25|(~v3__1|v3__3)&(__Z__27|__R__POS__v1__v3)&(__Z__27|(__Z__28|~v3__0)&(__Z__27|(__Z__28|v3__2)&(__Z__27|(~__Z__28|~v3__1)&(__Z__27|(~__Z__28|v3__3)&(~__Z__27|~__R__POS__v1__v3)&(~__Z__27|(v3__0|~v3__2)&(~__Z__27|(v3__1|~v3__3)&(__R__NEG__v1__v3&~__R__POS__v1__v3)&(__Z__29|__R__NEG__v2__v1)&(__Z__29|v1__0)&(__Z__29|~v1__1)&(~__Z__29|~__R__NEG__v2__v1)&(~__Z__29|(~v1__0|v1__1)&(__Z__30|__R__POS__v2__v1)&(__Z__30|~v1__0)&(__Z__30|v1__1)&(~__Z__30|~__R__POS__v2__v1)&(~__Z__30|(v1__0|~v1__1)&(__R__POS__v2__v1&~__R__NEG__v2__v1)&(__Z__31|__R__NEG__v3__v2)&(__Z__31|(__Z__32|v2__0)&(__Z__31|(__Z__32|~v2__1)&(__Z__31|(~__Z__32|v2__2)&(__Z__31|(~__Z__32|~v2__3)&(~__Z__31|~__R__NEG__v3__v2)&(~__Z__31|(~v2__0|v2__1)&(~__Z__31|(~v2__2|v2__3)&(__Z__33|__R__POS__v3__v2)&(__Z__33|(__Z__34|~v2__0)&(__Z__33|(__Z__34|v2__1)&(__Z__33|(~__Z__34|~v2__2)&(__Z__33|(~__Z__34|v2__3)&(~__Z__33|~__R__POS__v3__v2)&(~__Z__33|(v2__0|~v2__1)&(~__Z__33|(v2__2|~v2__3)&(__R__POS__v3__v2&~__R__NEG__v3__v2)&(__Z__35|__R__NEG__v3__v3)&(__Z__35|(__Z__36|v3__0)&(__Z__35|(__Z__36|~v3__1)&(__Z__35|(~__Z__36|v3__2)&(__Z__35|(~__Z__36|~v3__3)&(~__Z__35|~__R__NEG__v3__v3)&(~__Z__35|(~v3__0|v3__1)&(~__Z__35|(~v3__2|v3__3)&(__Z__37|__R__POS__v3__v3)&(__Z__37|(__Z__38|~v3__0)&(__Z__37|(__Z__38|v3__1)&(__Z__37|(~__Z__38|~v3__2)&(__Z__37|(~__Z__38|v3__3)&(~__Z__37|~__R__POS__v3__v3)&(~__Z__37|(v3__0|~v3__1)&(~__Z__37|(v3__2|~v3__3)&~__R__NEG__v3__v3)&(v3__0|(v1__0|v2__0)&(~v3__1|(v1__0|v2__1)&(v3__0|(v1__1|~v2__0)&(~v3__1|(v1__1|~v2__1)&(v3__2|(~v1__0|v2__2)&(~v3__3|(~v1__0|v2__3)&(v3__2|(~v1__1|~v2__2)&(~v3__3|(~v1__1|~v2__3)
Satisfiable:
(__Z__17|__R__NEG__v1__v2)&(__Z__17|(__Z__18|v2__0)&(__Z__17|(__Z__18|~v2__2)&(__Z__17|(~__Z__18|v2__1)&(__Z__17|(~__Z__18|~v2__3)&(~__Z__17|~__R__NEG__v1__v2)&(~__Z__17|(~v2__0|v2__2)&(~__Z__17|(~v2__1|v2__3)&(__Z__19|__R__POS__v1__v2)&(__Z__19|(__Z__20|~v2__0)&(__Z__19|(__Z__20|v2__2)&(__Z__19|(~__Z__20|~v2__1)&(__Z__19|(~__Z__20|v2__3)&(~__Z__19|~__R__POS__v1__v2)&(~__Z__19|(v2__0|~v2__2)&(~__Z__19|(v2__1|~v2__3)&(__R__POS__v1__v2&~__R__NEG__v1__v2)&(__Z__21|__R__NEG__v1__v3)&(__Z__21|v3__0)&(__Z__21|~v3__1)&(~__Z__21|~__R__NEG__v1__v3)&(~__Z__21|(~v3__0|v3__1)&(__Z__22|__R__POS__v1__v3)&(__Z__22|~v3__0)&(__Z__22|v3__1)&(~__Z__22|~__R__POS__v1__v3)&(~__Z__22|(v3__0|~v3__1)&(__R__NEG__v1__v3&~__R__POS__v1__v3)&(__Z__23|__R__NEG__v2__v1)&(__Z__23|v1__0)&(__Z__23|~v1__1)&(~__Z__23|~__R__NEG__v2__v1)&(~__Z__23|(~v1__0|v1__1)&(__Z__24|__R__POS__v2__v1)&(__Z__24|~v1__0)&(__Z__24|v1__1)&(~__Z__24|~__R__POS__v2__v1)&(~__Z__24|(v1__0|~v1__1)&(__R__POS__v2__v1&~__R__NEG__v2__v1)&(__Z__25|__R__NEG__v3__v2)&(__Z__25|(__Z__26|v2__0)&(__Z__25|(__Z__26|~v2__1)&(__Z__25|(~__Z__26|v2__2)&(__Z__25|(~__Z__26|~v2__3)&(~__Z__25|~__R__NEG__v3__v2)&(~__Z__25|(~v2__0|v2__1)&(~__Z__25|(~v2__2|v2__3)&(__Z__27|__R__POS__v3__v2)&(__Z__27|(__Z__28|~v2__0)&(__Z__27|(__Z__28|v2__1)&(__Z__27|(~__Z__28|~v2__2)&(__Z__27|(~__Z__28|v2__3)&(~__Z__27|~__R__POS__v3__v2)&(~__Z__27|(v2__0|~v2__1)&(~__Z__27|(v2__2|~v2__3)&(__R__POS__v3__v2&~__R__NEG__v3__v2)
Satisfiable: LA FORMULA NO ESTA CORRECTA
(__Z__17|__R__NEG__v1__v2)&(__Z__17|(__Z__18|v2__0)&(__Z__17|(__Z__18|~v2__2)&(__Z__17|(~__Z__18|v2__1)&(__Z__17|(~__Z__18|~v2__3)&(~__Z__17|~__R__NEG__v1__v2)&(~__Z__17|(~v2__0|v2__2)&(~__Z__17|(~v2__1|v2__3)&(__Z__19|__R__POS__v1__v2)&(__Z__19|(__Z__20|~v2__0)&(__Z__19|(__Z__20|v2__2)&(__Z__19|(~__Z__20|~v2__1)&(__Z__19|(~__Z__20|v2__3)&(~__Z__19|~__R__POS__v1__v2)&(~__Z__19|(v2__0|~v2__2)&(~__Z__19|(v2__1|~v2__3)&(__R__POS__v1__v2)&(~__R__NEG__v1__v2)&(__Z__21|__R__NEG__v1__v3)&(__Z__21|v3__0)&(__Z__21|~v3__1)&(~__Z__21|~__R__NEG__v1__v3)&(~__Z__21|(~v3__0|v3__1)&(__Z__22|__R__POS__v1__v3)&(__Z__22|~v3__0)&(__Z__22|v3__1)&(~__Z__22|~__R__POS__v1__v3)&(~__Z__22|(v3__0|~v3__1)&(__R__NEG__v1__v3&~__R__POS__v1__v3)&(__Z__23|__R__NEG__v2__v1)&(__Z__23|v1__0)&(__Z__23|~v1__1)&(~__Z__23|~__R__NEG__v2__v1)&(~__Z__23|(~v1__0|v1__1)&(__Z__24|__R__POS__v2__v1)&(__Z__24|~v1__0)&(__Z__24|v1__1)&(~__Z__24|~__R__POS__v2__v1)&(~__Z__24|(v1__0|~v1__1)&(__R__POS__v2__v1)&(~__R__NEG__v2__v1)&(__Z__25|__R__NEG__v3__v2)&(__Z__25|(__Z__26|v2__0)&(__Z__25|(__Z__26|~v2__1)&(__Z__25|(~__Z__26|v2__2)&(__Z__25|(~__Z__26|~v2__3)&(~__Z__25|~__R__NEG__v3__v2)&(~__Z__25|(~v2__0|v2__1)&(~__Z__25|(~v2__2|v2__3)&(__Z__27|__R__POS__v3__v2)&(__Z__27|(__Z__28|~v2__0)&(__Z__27|(__Z__28|v2__1)&(__Z__27|(~__Z__28|~v2__2)&(__Z__27|(~__Z__28|v2__3)&(~__Z__27|~__R__POS__v3__v2)&(~__Z__27|(v2__0|~v2__1)&(~__Z__27|(v2__2|~v2__3)&(__R__POS__v3__v2&~__R__NEG__v3__v2)
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Cadenas de Markov"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Descripción.\n",
"![Cadena de Markov](\"markov.png\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Cadenas de Markov"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Descripción.\n",
"![Cadena de Markov](markov.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Matriz de probabilidades de transición"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[ 0.4 0.1]\n",
" [ 0.6 0.9]]\n"
]
}
],
"source": [
"import numpy as np\n",
"\n",
"# define la matriz de probabilidades de transición\n",
"# utilizando el paquete de cómputo científico de Python numpy\n",
"\n",
"#A = | p(d|d), p(b|d), p(c|d) |\n",
"# | p(b|d), p(b|b), p(c|b) |\n",
"# | p(c|d), p(b|c), p(c|c) |\n",
"\n",
"# por ejemplo la matriz\n",
"#A = | 0.4, 0.1|\n",
"# | 0.6, 0.9|\n",
"# puede definirse en python como\n",
"A = np.matrix([[0.4,0.1],[0.6,0.9]])\n",
"\n",
"print(A)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Encontrar la distribución de probabilidad estacionaria elevando a un exponente grande"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[ 0.14285714 0.14285714]\n",
" [ 0.85714286 0.85714286]]\n",
"[[ 0.14285714 0.14285714]\n",
" [ 0.85714286 0.85714286]]\n"
]
}
],
"source": [
"B = np.linalg.matrix_power(A,50)\n",
"print(B)\n",
"B = np.linalg.matrix_power(A,100)\n",
"print(B)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Encontrar la misma distribución calculando los eigenvectores"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [],
"source": [
"w,v = np.linalg.eig(A)"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[ 0.3 1. ]\n",
"[[-0.70710678 -0.16439899]\n",
" [ 0.70710678 -0.98639392]]\n"
]
}
],
"source": [
"print(w)\n",
"print(v)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"matrix([[ 0.14285714],\n",
" [ 0.85714286]])"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"v[:,1]/sum(v[:,1])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 16 12:09:07 2018
@author: stan
"""
#%%
import simplejson, urllib
orig_coord = 19.3071075,-99.1843678
dest_coord = 20.6665935,-103.3530723
urlstr = "http://maps.googleapis.com/maps/api/distancematrix/json?origins={0}&destinations={1}&mode=driving&language=en-EN&sensor=false".format(str(orig_coord),str(dest_coord))
print(urlstr)
with urllib.request.urlopen(urlstr) as url:
result= simplejson.load(urllib.read(url))
driving_time = result['rows'][0]['elements'][0]['duration']['value']
#%%
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
#plt.figure(num=None, figsize=(8, 6), dpi=300, facecolor='w', edgecolor='k')
m = Basemap(projection='lcc',
lon_0=-121,lat_0=16,\
llcrnrlat=16,urcrnrlat=30,\
llcrnrlon=-121,urcrnrlon=-84,rsphere=6371200.,resolution='h')
# create polar stereographic Basemap instance.
#m = Basemap(projection='stere',lon_0=-120,lat_0=16,\
#llcrnrlat=16,urcrnrlat=29,\
#llcrnrlon=-119,urcrnrlon=-84,\
#rsphere=6371200.,resolution='h') #c, l, i, h, f
#m.fillcontinents(color='white', alpha=0.6, zorder=0)
#m.fillcontinents(color='coral',lake_color='aqua')
#m.bluemarble()
#m.etopo()
m.drawstates()
m.drawcoastlines()
m.drawcountries()
m.fillcontinents(color='lightgray',zorder=0)
#m.drawrivers(color='b', linewidth=.1)
# draw parallels.
#parallels = np.arange(0.,90,1.)
#m.drawparallels(parallels,labels=[1,0,0,0],fontsize=10)
## draw meridians
#meridians = np.arange(180.,360.,1.)
#m.drawmeridians(meridians,labels=[0,0,0,1],fontsize=10)
ciudades = {
('Aguascalientes Aguascalientes', -102.305481910559, 21.8475186),
('Mexicali Baja California', -115.4440698, 32.6200699),
('La Paz Baja California', -110.4135535, 24.1017563),
('Tuxtla Gutierrez Chiapas', -93.1418086426027, 16.74521845),
('Chihuahua Chihuahua', -106.384451167241, 28.938764),
('Campeche Campeche', -90.25414928915, 19.59188245),
('Saltillo Tamaulipas', -100.9887188, 25.4466476),
('Colima Colima', -103.654240318428, 19.0986013),
('Durango Durango', -104.919810561772, 23.9112721),
('Guanajuato Guanajuato', -101.242782801753, 21.02405745),
('Chilpancingo Guerrero', -99.5048416, 17.5542149),
('Pachuca Hidalgo', -98.7413535, 20.1165413),
('Guadalajara Jalisco', -103.3469982, 20.676143),
('Toluca Mexico', -99.4890962, 19.2819217),
('Morelia Michoacan', -101.1923818, 19.7027116),
('Cuernavaca Morelos', -99.2342282, 18.9218274),
('Tepic Nayarit', -105.1423419, 21.7206915),
('Monterrey Nuevo Leon', -100.293101629066, 25.63978365),
('Oaxaca Oaxaca', -96.7253575, 17.0604663),
('Puebla Puebla', -98.1984744, 19.0437227),
('Queretaro Queretaro', -100.3879904, 20.5878372),
('Chetumal Quintana Roo', -88.3006444, 18.5132414),
('San Luis Potosi San Luis Potosi', -100.926198413959, 22.3089625),
('Culiacan Sinaloa', -107.3936301, 24.8015732),
('Hermosillo Sonora', -110.9612378, 29.0894152),
('Villa Hermosa Tabasco', -91.5269144, 14.8411997),
('Ciudad Victoria Tamaulipas', -99.1419341, 23.7439573),
('Tlaxcala Tlaxcala', -98.2376413321235, 19.3173725),
('Xalapa Veracruz', -96.9238793, 19.5274085),
('Merida Yucatan', -89.6237402, 20.9670759),
('Zacatecas Zacatecas', -102.668598836424, 22.7293312)}
C,X,Y = zip(*ciudades)
X,Y = m(X,Y)
m.scatter(X, Y,color='red',s=50,marker='o',zorder=1)
plt.show()
#%%
from geopy.geocoders import Nominatim
capitales = ["Aguascalientes Aguascalientes",
"Mexicali Baja California",
"La Paz Baja California",
"Tuxtla Gutierrez Chiapas",
"Chihuahua Chihuahua",
"Campeche Campeche",
"Saltillo Tamaulipas",
"Colima Colima",
"Durango Durango",
"Guanajuato Guanajuato",
"Chilpancingo Guerrero",
"Pachuca Hidalgo",
"Guadalajara Jalisco",
"Toluca Mexico",
"Morelia Michoacan",
"Cuernavaca Morelos",
"Tepic Nayarit",
"Monterrey Nuevo Leon",
"Oaxaca Oaxaca",
"Puebla Puebla",
"Queretaro Queretaro",
"Chetumal Quintana Roo",
"San Luis Potosi San Luis Potosi",
"Culiacan Sinaloa",
"Hermosillo Sonora",
"Villa Hermosa Tabasco",
"Ciudad Victoria Tamaulipas",
"Tlaxcala Tlaxcala",
"Xalapa Veracruz",
"Merida Yucatan",
"Zacatecas Zacatecas"]
geolocator = Nominatim(user_agent='myapplication')
for city in capitales:
location = geolocator.geocode(city)
print((city,location.longitude,location.latitude))
\ No newline at end of file
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 16 12:09:07 2018
@author: stan
"""
#%%
import simplejson, urllib
orig_coord = 19.3071075,-99.1843678
dest_coord = 20.6665935,-103.3530723
urlstr = "http://maps.googleapis.com/maps/api/distancematrix/json?origins={0}&destinations={1}&mode=driving&language=en-EN&sensor=false".format(str(orig_coord),str(dest_coord))
print(urlstr)
with urllib.request.urlopen(urlstr) as url:
result= simplejson.load(urllib.read(url))
driving_time = result['rows'][0]['elements'][0]['duration']['value']
#%%
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
#
#fig = plt.figure()
#ax = fig.add_subplot(1,1,1)
#plt.figure(num=None, figsize=(8, 6), dpi=300, facecolor='w', edgecolor='k')
m = Basemap(projection='lcc',
lon_0=-121,lat_0=16,\
llcrnrlat=16,urcrnrlat=30,\
llcrnrlon=-121,urcrnrlon=-84,rsphere=6371200.,resolution='h')
# create polar stereographic Basemap instance.
#m = Basemap(projection='stere',lon_0=-120,lat_0=16,\
#llcrnrlat=16,urcrnrlat=29,\
#llcrnrlon=-119,urcrnrlon=-84,\
#rsphere=6371200.,resolution='h') #c, l, i, h, f
#m.fillcontinents(color='white', alpha=0.6, zorder=0)
#m.fillcontinents(color='coral',lake_color='aqua')
#m.bluemarble()
#m.etopo()
m.drawstates()
m.drawcoastlines()
m.drawcountries()
m.fillcontinents(color='lightgray',zorder=0)
#m.drawrivers(color='b', linewidth=.1)
# draw parallels.
#parallels = np.arange(0.,90,1.)
#m.drawparallels(parallels,labels=[1,0,0,0],fontsize=10)
## draw meridians
#meridians = np.arange(180.,360.,1.)
#m.drawmeridians(meridians,labels=[0,0,0,1],fontsize=10)
ciudades = {
('Aguascalientes Aguascalientes', -102.305481910559, 21.8475186),
('Mexicali Baja California', -115.4440698, 32.6200699),
('La Paz Baja California', -110.4135535, 24.1017563),
('Tuxtla Gutierrez Chiapas', -93.1418086426027, 16.74521845),
('Chihuahua Chihuahua', -106.384451167241, 28.938764),
('Campeche Campeche', -90.25414928915, 19.59188245),
('Saltillo Tamaulipas', -100.9887188, 25.4466476),
('Colima Colima', -103.654240318428, 19.0986013),
('Durango Durango', -104.919810561772, 23.9112721),
('Guanajuato Guanajuato', -101.242782801753, 21.02405745),
('Chilpancingo Guerrero', -99.5048416, 17.5542149),
('Pachuca Hidalgo', -98.7413535, 20.1165413),
('Guadalajara Jalisco', -103.3469982, 20.676143),
('Toluca Mexico', -99.4890962, 19.2819217),
('Morelia Michoacan', -101.1923818, 19.7027116),
('Cuernavaca Morelos', -99.2342282, 18.9218274),
('Tepic Nayarit', -105.1423419, 21.7206915),
('Monterrey Nuevo Leon', -100.293101629066, 25.63978365),
('Oaxaca Oaxaca', -96.7253575, 17.0604663),
('Puebla Puebla', -98.1984744, 19.0437227),
('Queretaro Queretaro', -100.3879904, 20.5878372),
('Chetumal Quintana Roo', -88.3006444, 18.5132414),
('San Luis Potosi San Luis Potosi', -100.926198413959, 22.3089625),
('Culiacan Sinaloa', -107.3936301, 24.8015732),
('Hermosillo Sonora', -110.9612378, 29.0894152),
('Villa Hermosa Tabasco', -92.9881407, 17.992608),
('Ciudad Victoria Tamaulipas', -99.1419341, 23.7439573),
('Tlaxcala Tlaxcala', -98.2376413321235, 19.3173725),
('Xalapa Veracruz', -96.9238793, 19.5274085),
('Merida Yucatan', -89.6237402, 20.9670759),
('Zacatecas Zacatecas', -102.668598836424, 22.7293312)}
C,X,Y = zip(*ciudades)
X,Y = m(X,Y)
m.scatter(X, Y,color='red',s=50,marker='o',zorder=1)
lines, = plt.plot(X,Y)
ax = plt.gca()
plt.pause(2)
ax.lines.remove(lines)
plt.draw()
plt.show()
#%%
np.array(list(zip(X,Y)))
#%%
from geopy.geocoders import Nominatim
capitales = ["Aguascalientes Aguascalientes",
"Mexicali Baja California",
"La Paz Baja California",
"Tuxtla Gutierrez Chiapas",
"Chihuahua Chihuahua",
"Campeche Campeche",
"Saltillo Tamaulipas",
"Colima Colima",
"Durango Durango",
"Guanajuato Guanajuato",
"Chilpancingo Guerrero",
"Pachuca Hidalgo",
"Guadalajara Jalisco",
"Toluca Mexico",
"Morelia Michoacan",
"Cuernavaca Morelos",
"Tepic Nayarit",
"Monterrey Nuevo Leon",
"Oaxaca Oaxaca",
"Puebla Puebla",
"Queretaro Queretaro",
"Chetumal Quintana Roo",
"San Luis Potosi San Luis Potosi",
"Culiacan Sinaloa",
"Hermosillo Sonora",
"Villa Hermosa Tabasco",
"Ciudad Victoria Tamaulipas",
"Tlaxcala Tlaxcala",
"Xalapa Veracruz",
"Merida Yucatan",
"Zacatecas Zacatecas"]
geolocator = Nominatim(user_agent='myapplication')
for city in capitales:
location = geolocator.geocode(city)
print((city,location.longitude,location.latitude))
\ No newline at end of file
(?m)(.*$)*[^a-zA-Z]*P\(homicida\)\s*=\s*0.0(09[0-9]*|1[0-9]*)[^a-zA-Z]*$[^a-zA-Z]*P\(sangre\)\s*=\s*0.10[0-9]*[^a-zA-Z]*$[^a-zA-Z]*P\(cuchillo\)\s*=\s*0.25[0-9]*[^a-zA-Z]*$[^a-zA-Z]*P\(~cuchillo\)\s*=\s*0.74[0-9]*[^a-zA-Z]*$[^a-zA-Z]*P\(~cuchillo\|homicida\)\s*=\s*0.1[45][0-9]*[^a-zA-Z]*$[^a-zA-Z]*P\(homicida\|cuchillo,sangre\)\s*=\s*0.21[456][0-9]*[^a-zA-Z]*$(.*$)*
P(homicida) = 0.01
P(sangre) = 0.10700000000000001
P(cuchillo) = 0.256
P(~cuchillo) = 0.744
P(~cuchillo|homicida) = 0.15000000000000002
P(homicida|cuchillo,sangre) = 0.21553090332805072
P(~cuchillo|homicida) = 0.15000000000000002
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment