380 lines
54 KiB
XML
380 lines
54 KiB
XML
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
|
|
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.6">
|
|
<compounddef id="distinct_2graph_8hpp" kind="file">
|
|
<compoundname>graph.hpp</compoundname>
|
|
<includes local="no">climits</includes>
|
|
<includedby refid="int_2distinct_8hh" local="no">/usr/include/gecode/int/distinct.hh</includedby>
|
|
<incdepgraph>
|
|
<node id="13331">
|
|
<label>/usr/include/gecode/int/distinct/graph.hpp</label>
|
|
<link refid="distinct/graph.hpp"/>
|
|
<childnode refid="13332" relation="include">
|
|
</childnode>
|
|
</node>
|
|
<node id="13332">
|
|
<label>climits</label>
|
|
</node>
|
|
</incdepgraph>
|
|
<invincdepgraph>
|
|
<node id="13339">
|
|
<label>/usr/include/gecode/int/nvalues/int-base.hpp</label>
|
|
<link refid="nvalues_2int-base_8hpp_source"/>
|
|
<childnode refid="13340" relation="include">
|
|
</childnode>
|
|
</node>
|
|
<node id="13337">
|
|
<label>/usr/include/gecode/int/gcc/post.hpp</label>
|
|
<link refid="int_2gcc_2post_8hpp_source"/>
|
|
<childnode refid="13338" relation="include">
|
|
</childnode>
|
|
</node>
|
|
<node id="13334">
|
|
<label>/usr/include/gecode/int/distinct.hh</label>
|
|
<link refid="int_2distinct_8hh_source"/>
|
|
<childnode refid="13335" relation="include">
|
|
</childnode>
|
|
<childnode refid="13336" relation="include">
|
|
</childnode>
|
|
<childnode refid="13337" relation="include">
|
|
</childnode>
|
|
<childnode refid="13339" relation="include">
|
|
</childnode>
|
|
<childnode refid="13341" relation="include">
|
|
</childnode>
|
|
<childnode refid="13342" relation="include">
|
|
</childnode>
|
|
<childnode refid="13343" relation="include">
|
|
</childnode>
|
|
<childnode refid="13344" relation="include">
|
|
</childnode>
|
|
</node>
|
|
<node id="13342">
|
|
<label>/usr/include/gecode/int/nvalues/int-gq.hpp</label>
|
|
<link refid="nvalues_2int-gq_8hpp_source"/>
|
|
<childnode refid="13340" relation="include">
|
|
</childnode>
|
|
</node>
|
|
<node id="13333">
|
|
<label>/usr/include/gecode/int/distinct/graph.hpp</label>
|
|
<link refid="distinct/graph.hpp"/>
|
|
<childnode refid="13334" relation="include">
|
|
</childnode>
|
|
</node>
|
|
<node id="13343">
|
|
<label>/usr/include/gecode/int/nvalues/int-lq.hpp</label>
|
|
<link refid="nvalues_2int-lq_8hpp_source"/>
|
|
<childnode refid="13340" relation="include">
|
|
</childnode>
|
|
</node>
|
|
<node id="13335">
|
|
<label>/usr/include/gecode/int/channel.hh</label>
|
|
<link refid="int_2channel_8hh_source"/>
|
|
</node>
|
|
<node id="13340">
|
|
<label>/usr/include/gecode/int/nvalues.hh</label>
|
|
<link refid="nvalues_8hh_source"/>
|
|
</node>
|
|
<node id="13344">
|
|
<label>/usr/include/gecode/int/sorted/propagate.hpp</label>
|
|
<link refid="sorted_2propagate_8hpp_source"/>
|
|
<childnode refid="13345" relation="include">
|
|
</childnode>
|
|
</node>
|
|
<node id="13338">
|
|
<label>/usr/include/gecode/int/gcc.hh</label>
|
|
<link refid="gcc_8hh_source"/>
|
|
</node>
|
|
<node id="13345">
|
|
<label>/usr/include/gecode/int/sorted.hh</label>
|
|
<link refid="sorted_8hh_source"/>
|
|
</node>
|
|
<node id="13341">
|
|
<label>/usr/include/gecode/int/nvalues/int-eq.hpp</label>
|
|
<link refid="nvalues_2int-eq_8hpp_source"/>
|
|
<childnode refid="13340" relation="include">
|
|
</childnode>
|
|
</node>
|
|
<node id="13336">
|
|
<label>/usr/include/gecode/int/circuit.hh</label>
|
|
<link refid="circuit_8hh_source"/>
|
|
</node>
|
|
</invincdepgraph>
|
|
<innernamespace refid="namespaceGecode">Gecode</innernamespace>
|
|
<innernamespace refid="namespaceGecode_1_1Int">Gecode::Int</innernamespace>
|
|
<innernamespace refid="namespaceGecode_1_1Int_1_1Distinct">Gecode::Int::Distinct</innernamespace>
|
|
<briefdescription>
|
|
</briefdescription>
|
|
<detaileddescription>
|
|
</detaileddescription>
|
|
<programlisting>
|
|
<codeline lineno="1"><highlight class="comment">/*<sp/>-*-<sp/>mode:<sp/>C++;<sp/>c-basic-offset:<sp/>2;<sp/>indent-tabs-mode:<sp/>nil<sp/>-*-<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="2"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline>
|
|
<codeline lineno="3"><highlight class="comment"><sp/>*<sp/><sp/>Main<sp/>authors:</highlight></codeline>
|
|
<codeline lineno="4"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/>Christian<sp/>Schulte<sp/><schulte@gecode.org></highlight></codeline>
|
|
<codeline lineno="5"><highlight class="comment"><sp/>*</highlight></codeline>
|
|
<codeline lineno="6"><highlight class="comment"><sp/>*<sp/><sp/>Copyright:</highlight></codeline>
|
|
<codeline lineno="7"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/>Christian<sp/>Schulte,<sp/>2003</highlight></codeline>
|
|
<codeline lineno="8"><highlight class="comment"><sp/>*</highlight></codeline>
|
|
<codeline lineno="9"><highlight class="comment"><sp/>*<sp/><sp/>Last<sp/>modified:</highlight></codeline>
|
|
<codeline lineno="10"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/>$Date:<sp/>2012-09-07<sp/>17:31:22<sp/>+0200<sp/>(Fri,<sp/>07<sp/>Sep<sp/>2012)<sp/>$<sp/>by<sp/>$Author:<sp/>schulte<sp/>$</highlight></codeline>
|
|
<codeline lineno="11"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/>$Revision:<sp/>13068<sp/>$</highlight></codeline>
|
|
<codeline lineno="12"><highlight class="comment"><sp/>*</highlight></codeline>
|
|
<codeline lineno="13"><highlight class="comment"><sp/>*<sp/><sp/>This<sp/>file<sp/>is<sp/>part<sp/>of<sp/>Gecode,<sp/>the<sp/>generic<sp/>constraint</highlight></codeline>
|
|
<codeline lineno="14"><highlight class="comment"><sp/>*<sp/><sp/>development<sp/>environment:</highlight></codeline>
|
|
<codeline lineno="15"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/>http://www.gecode.org</highlight></codeline>
|
|
<codeline lineno="16"><highlight class="comment"><sp/>*</highlight></codeline>
|
|
<codeline lineno="17"><highlight class="comment"><sp/>*<sp/><sp/>Permission<sp/>is<sp/>hereby<sp/>granted,<sp/>free<sp/>of<sp/>charge,<sp/>to<sp/>any<sp/>person<sp/>obtaining</highlight></codeline>
|
|
<codeline lineno="18"><highlight class="comment"><sp/>*<sp/><sp/>a<sp/>copy<sp/>of<sp/>this<sp/>software<sp/>and<sp/>associated<sp/>documentation<sp/>files<sp/>(the</highlight></codeline>
|
|
<codeline lineno="19"><highlight class="comment"><sp/>*<sp/><sp/>"Software"),<sp/>to<sp/>deal<sp/>in<sp/>the<sp/>Software<sp/>without<sp/>restriction,<sp/>including</highlight></codeline>
|
|
<codeline lineno="20"><highlight class="comment"><sp/>*<sp/><sp/>without<sp/>limitation<sp/>the<sp/>rights<sp/>to<sp/>use,<sp/>copy,<sp/>modify,<sp/>merge,<sp/>publish,</highlight></codeline>
|
|
<codeline lineno="21"><highlight class="comment"><sp/>*<sp/><sp/>distribute,<sp/>sublicense,<sp/>and/or<sp/>sell<sp/>copies<sp/>of<sp/>the<sp/>Software,<sp/>and<sp/>to</highlight></codeline>
|
|
<codeline lineno="22"><highlight class="comment"><sp/>*<sp/><sp/>permit<sp/>persons<sp/>to<sp/>whom<sp/>the<sp/>Software<sp/>is<sp/>furnished<sp/>to<sp/>do<sp/>so,<sp/>subject<sp/>to</highlight></codeline>
|
|
<codeline lineno="23"><highlight class="comment"><sp/>*<sp/><sp/>the<sp/>following<sp/>conditions:</highlight></codeline>
|
|
<codeline lineno="24"><highlight class="comment"><sp/>*</highlight></codeline>
|
|
<codeline lineno="25"><highlight class="comment"><sp/>*<sp/><sp/>The<sp/>above<sp/>copyright<sp/>notice<sp/>and<sp/>this<sp/>permission<sp/>notice<sp/>shall<sp/>be</highlight></codeline>
|
|
<codeline lineno="26"><highlight class="comment"><sp/>*<sp/><sp/>included<sp/>in<sp/>all<sp/>copies<sp/>or<sp/>substantial<sp/>portions<sp/>of<sp/>the<sp/>Software.</highlight></codeline>
|
|
<codeline lineno="27"><highlight class="comment"><sp/>*</highlight></codeline>
|
|
<codeline lineno="28"><highlight class="comment"><sp/>*<sp/><sp/>THE<sp/>SOFTWARE<sp/>IS<sp/>PROVIDED<sp/>"AS<sp/>IS",<sp/>WITHOUT<sp/>WARRANTY<sp/>OF<sp/>ANY<sp/>KIND,</highlight></codeline>
|
|
<codeline lineno="29"><highlight class="comment"><sp/>*<sp/><sp/>EXPRESS<sp/>OR<sp/>IMPLIED,<sp/>INCLUDING<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO<sp/>THE<sp/>WARRANTIES<sp/>OF</highlight></codeline>
|
|
<codeline lineno="30"><highlight class="comment"><sp/>*<sp/><sp/>MERCHANTABILITY,<sp/>FITNESS<sp/>FOR<sp/>A<sp/>PARTICULAR<sp/>PURPOSE<sp/>AND</highlight></codeline>
|
|
<codeline lineno="31"><highlight class="comment"><sp/>*<sp/><sp/>NONINFRINGEMENT.<sp/>IN<sp/>NO<sp/>EVENT<sp/>SHALL<sp/>THE<sp/>AUTHORS<sp/>OR<sp/>COPYRIGHT<sp/>HOLDERS<sp/>BE</highlight></codeline>
|
|
<codeline lineno="32"><highlight class="comment"><sp/>*<sp/><sp/>LIABLE<sp/>FOR<sp/>ANY<sp/>CLAIM,<sp/>DAMAGES<sp/>OR<sp/>OTHER<sp/>LIABILITY,<sp/>WHETHER<sp/>IN<sp/>AN<sp/>ACTION</highlight></codeline>
|
|
<codeline lineno="33"><highlight class="comment"><sp/>*<sp/><sp/>OF<sp/>CONTRACT,<sp/>TORT<sp/>OR<sp/>OTHERWISE,<sp/>ARISING<sp/>FROM,<sp/>OUT<sp/>OF<sp/>OR<sp/>IN<sp/>CONNECTION</highlight></codeline>
|
|
<codeline lineno="34"><highlight class="comment"><sp/>*<sp/><sp/>WITH<sp/>THE<sp/>SOFTWARE<sp/>OR<sp/>THE<sp/>USE<sp/>OR<sp/>OTHER<sp/>DEALINGS<sp/>IN<sp/>THE<sp/>SOFTWARE.</highlight></codeline>
|
|
<codeline lineno="35"><highlight class="comment"><sp/>*</highlight></codeline>
|
|
<codeline lineno="36"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="37"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="38"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><climits></highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="39"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="40"><highlight class="normal"></highlight><highlight class="keyword">namespace<sp/></highlight><highlight class="normal">Gecode<sp/>{<sp/></highlight><highlight class="keyword">namespace<sp/></highlight><highlight class="normal">Int<sp/>{<sp/></highlight><highlight class="keyword">namespace<sp/></highlight><highlight class="normal">Distinct<sp/>{</highlight></codeline>
|
|
<codeline lineno="41"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="42"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">template</highlight><highlight class="normal"><</highlight><highlight class="keyword">class</highlight><highlight class="normal"><sp/>View></highlight></codeline>
|
|
<codeline lineno="43"><highlight class="normal"><sp/><sp/>forceinline</highlight></codeline>
|
|
<codeline lineno="44" refid="classGecode_1_1Int_1_1Distinct_1_1Graph_1ae21b6849e80f96b03c3910a0be81bf1d" refkind="member"><highlight class="normal"><sp/><sp/><ref refid="classGecode_1_1Int_1_1Distinct_1_1Graph_1ae21b6849e80f96b03c3910a0be81bf1d" kindref="member">Graph<View>::Graph</ref>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)<sp/>{}</highlight></codeline>
|
|
<codeline lineno="45"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="46"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">template</highlight><highlight class="normal"><</highlight><highlight class="keyword">class</highlight><highlight class="normal"><sp/>View></highlight></codeline>
|
|
<codeline lineno="47"><highlight class="normal"><sp/><sp/>forceinline<sp/><ref refid="namespaceGecode_1ab278aee34126d2f13c5429ee3c4ed3b5" kindref="member">ExecStatus</ref></highlight></codeline>
|
|
<codeline lineno="48" refid="classGecode_1_1Int_1_1Distinct_1_1Graph_1a186decb83836d26a7ed772b916373a1e" refkind="member"><highlight class="normal"><sp/><sp/><ref refid="classGecode_1_1Int_1_1Distinct_1_1Graph_1a186decb83836d26a7ed772b916373a1e" kindref="member">Graph<View>::init</ref>(<ref refid="classGecode_1_1Space" kindref="compound">Space</ref>&<sp/>home,<sp/><ref refid="classGecode_1_1ViewArray" kindref="compound">ViewArray<View></ref>&<sp/>x)<sp/>{</highlight></codeline>
|
|
<codeline lineno="49"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">using<sp/>namespace<sp/></highlight><highlight class="normal">ViewValGraph;</highlight></codeline>
|
|
<codeline lineno="50"><highlight class="normal"><sp/><sp/><sp/><sp/>n_view<sp/>=<sp/>x.<ref refid="classGecode_1_1ViewArray_1a65940b23e2457e97607475f8bd8f4ac6" kindref="member">size</ref>();</highlight></codeline>
|
|
<codeline lineno="51"><highlight class="normal"><sp/><sp/><sp/><sp/>view<sp/>=<sp/>home.<ref refid="group__FuncMemSpace_1gacf6b71739fd13f46d8d27052d714265e" kindref="member">alloc</ref><ViewNode<View>*>(n_view);</highlight></codeline>
|
|
<codeline lineno="52"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="53"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Find<sp/>value<sp/>information<sp/>for<sp/>construction<sp/>of<sp/>view<sp/>value<sp/>graph</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="54"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>min<sp/>=<sp/>x[n_view-1].min();</highlight></codeline>
|
|
<codeline lineno="55"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>max<sp/>=<sp/>x[n_view-1].max();</highlight></codeline>
|
|
<codeline lineno="56"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i=n_view-1;<sp/>i--;<sp/>)<sp/>{</highlight></codeline>
|
|
<codeline lineno="57"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>min<sp/>=<sp/><ref refid="group__TaskModelFloatArith_1ga121700708772a60191be6256c3c0d151" kindref="member">std::min</ref>(min,x[i].min());</highlight></codeline>
|
|
<codeline lineno="58"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>max<sp/>=<sp/><ref refid="group__TaskModelFloatArith_1ga958cb25ae9754d6cc35c7c6e34ebc1e3" kindref="member">std::max</ref>(max,x[i].max());</highlight></codeline>
|
|
<codeline lineno="59"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="60"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="61"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>width<sp/>=<sp/></highlight><highlight class="keyword">static_cast<</highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="keyword">></highlight><highlight class="normal">(max-min+1);</highlight></codeline>
|
|
<codeline lineno="62"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="63"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Definitly<sp/>not<sp/>enough<sp/>values</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="64"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(width<sp/><<sp/>static_cast<unsigned<sp/>int>(n_view))</highlight></codeline>
|
|
<codeline lineno="65"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="namespaceGecode_1ab278aee34126d2f13c5429ee3c4ed3b5a839b40c2e7ccebb2e61e92e274833089" kindref="member">ES_FAILED</ref>;</highlight></codeline>
|
|
<codeline lineno="66"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="67"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Initialize<sp/>view<sp/>nodes</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="68"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i=n_view;<sp/>i--;<sp/>)</highlight></codeline>
|
|
<codeline lineno="69"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>view[i]<sp/>=<sp/></highlight><highlight class="keyword">new</highlight><highlight class="normal"><sp/>(home)<sp/>ViewNode<View>(x[i]);</highlight></codeline>
|
|
<codeline lineno="70"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="71"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classGecode_1_1Region" kindref="compound">Region</ref><sp/>r(home);</highlight></codeline>
|
|
<codeline lineno="72"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="73"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(static_cast<unsigned<sp/>int>(n_view)*4<sp/>>=<sp/>width)<sp/>{</highlight></codeline>
|
|
<codeline lineno="74"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Values<sp/>are<sp/>dense:<sp/>use<sp/>a<sp/>mapping</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="75"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ValNode<View>**<sp/>val2node<sp/>=<sp/>r.alloc<ValNode<View>*<sp/>>(width);</highlight></codeline>
|
|
<codeline lineno="76"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="77"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(</highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i=width;<sp/>i--;<sp/>)</highlight></codeline>
|
|
<codeline lineno="78"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>val2node[i]=NULL;</highlight></codeline>
|
|
<codeline lineno="79"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="80"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i=n_view;<sp/>i--;<sp/>)<sp/>{</highlight></codeline>
|
|
<codeline lineno="81"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Edge<View>**<sp/>edge_p<sp/>=<sp/>view[i]->val_edges_ref();</highlight></codeline>
|
|
<codeline lineno="82"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<ref refid="classGecode_1_1Int_1_1ViewValues" kindref="compound">ViewValues<View></ref><sp/>xi(x[i]);<sp/>xi();<sp/>++xi)<sp/>{</highlight></codeline>
|
|
<codeline lineno="83"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(val2node[xi.val()-min]<sp/>==<sp/>NULL)</highlight></codeline>
|
|
<codeline lineno="84"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>val2node[xi.val()-min]<sp/>=<sp/></highlight><highlight class="keyword">new</highlight><highlight class="normal"><sp/>(home)<sp/>ValNode<View>(xi.val());</highlight></codeline>
|
|
<codeline lineno="85"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*edge_p<sp/>=<sp/></highlight><highlight class="keyword">new</highlight><highlight class="normal"><sp/>(home)<sp/>Edge<View>(val2node[xi.val()-min],view[i]);</highlight></codeline>
|
|
<codeline lineno="86"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>edge_p<sp/>=<sp/>(*edge_p)->next_edge_ref();</highlight></codeline>
|
|
<codeline lineno="87"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="88"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*edge_p<sp/>=<sp/>NULL;</highlight></codeline>
|
|
<codeline lineno="89"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="90"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="91"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(</highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i=width;<sp/>i--;<sp/>)</highlight></codeline>
|
|
<codeline lineno="92"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(val2node[i]<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
|
|
<codeline lineno="93"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>val2node[i]->next_val(val);</highlight></codeline>
|
|
<codeline lineno="94"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>val<sp/>=<sp/>val2node[i];</highlight></codeline>
|
|
<codeline lineno="95"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>n_val++;</highlight></codeline>
|
|
<codeline lineno="96"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="97"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="98"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
|
|
<codeline lineno="99"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Values<sp/>are<sp/>sparse</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="100"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i=n_view;<sp/>i--;<sp/>)</highlight></codeline>
|
|
<codeline lineno="101"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classGecode_1_1Int_1_1ViewValGraph_1_1Graph" kindref="compound">ViewValGraph::Graph<View>::init</ref>(home,view[i]);</highlight></codeline>
|
|
<codeline lineno="102"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="103"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="104"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(n_val<sp/><<sp/>n_view)</highlight></codeline>
|
|
<codeline lineno="105"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="namespaceGecode_1ab278aee34126d2f13c5429ee3c4ed3b5a839b40c2e7ccebb2e61e92e274833089" kindref="member">ES_FAILED</ref>;</highlight></codeline>
|
|
<codeline lineno="106"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="107"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">typename</highlight><highlight class="normal"><sp/><ref refid="classGecode_1_1Support_1_1StaticStack" kindref="compound">ViewValGraph::Graph<View>::ViewNodeStack</ref><sp/>m(r,n_view);</highlight></codeline>
|
|
<codeline lineno="108"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i<sp/>=<sp/>n_view;<sp/>i--;<sp/>)</highlight></codeline>
|
|
<codeline lineno="109"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!match(m,view[i]))</highlight></codeline>
|
|
<codeline lineno="110"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="namespaceGecode_1ab278aee34126d2f13c5429ee3c4ed3b5a839b40c2e7ccebb2e61e92e274833089" kindref="member">ES_FAILED</ref>;</highlight></codeline>
|
|
<codeline lineno="111"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="namespaceGecode_1ab278aee34126d2f13c5429ee3c4ed3b5a01d6fb1ec70479e8e413d5ecfd63e303" kindref="member">ES_OK</ref>;</highlight></codeline>
|
|
<codeline lineno="112"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="113"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="114"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">template</highlight><highlight class="normal"><</highlight><highlight class="keyword">class</highlight><highlight class="normal"><sp/>View></highlight></codeline>
|
|
<codeline lineno="115"><highlight class="normal"><sp/><sp/>forceinline<sp/></highlight><highlight class="keywordtype">bool</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="116" refid="classGecode_1_1Int_1_1Distinct_1_1Graph_1acbcacb78cc6f7510a11cff9d7bff6dcf" refkind="member"><highlight class="normal"><sp/><sp/><ref refid="classGecode_1_1Int_1_1Distinct_1_1Graph_1acbcacb78cc6f7510a11cff9d7bff6dcf" kindref="member">Graph<View>::sync</ref>(<ref refid="classGecode_1_1Space" kindref="compound">Space</ref>&<sp/>home)<sp/>{</highlight></codeline>
|
|
<codeline lineno="117"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">using<sp/>namespace<sp/></highlight><highlight class="normal">ViewValGraph;</highlight></codeline>
|
|
<codeline lineno="118"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classGecode_1_1Region" kindref="compound">Region</ref><sp/>r(home);</highlight></codeline>
|
|
<codeline lineno="119"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Stack<sp/>for<sp/>view<sp/>nodes<sp/>to<sp/>be<sp/>rematched</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="120"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">typename</highlight><highlight class="normal"><sp/><ref refid="classGecode_1_1Support_1_1StaticStack" kindref="compound">ViewValGraph::Graph<View>::ViewNodeStack</ref><sp/>re(r,n_view);</highlight></codeline>
|
|
<codeline lineno="121"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Synchronize<sp/>nodes</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="122"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i<sp/>=<sp/>n_view;<sp/>i--;<sp/>)<sp/>{</highlight></codeline>
|
|
<codeline lineno="123"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ViewNode<View>*<sp/>x<sp/>=<sp/>view[i];</highlight></codeline>
|
|
<codeline lineno="124"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x->view().assigned())<sp/>{</highlight></codeline>
|
|
<codeline lineno="125"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x->edge_fst()->val(x)->matching(NULL);</highlight></codeline>
|
|
<codeline lineno="126"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(Edge<View>*<sp/>e<sp/>=<sp/>x->val_edges();<sp/>e<sp/>!=<sp/>NULL;<sp/>e<sp/>=<sp/>e->next_edge())</highlight></codeline>
|
|
<codeline lineno="127"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>e->unlink();</highlight></codeline>
|
|
<codeline lineno="128"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>view[i]<sp/>=<sp/>view[--n_view];</highlight></codeline>
|
|
<codeline lineno="129"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x->changed())<sp/>{</highlight></codeline>
|
|
<codeline lineno="130"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classGecode_1_1Int_1_1ViewRanges" kindref="compound">ViewRanges<View></ref><sp/>r(x->view());</highlight></codeline>
|
|
<codeline lineno="131"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Edge<View>*<sp/><sp/>m<sp/>=<sp/>x->edge_fst();<sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Matching<sp/>edge</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="132"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Edge<View>**<sp/>p<sp/>=<sp/>x->val_edges_ref();</highlight></codeline>
|
|
<codeline lineno="133"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Edge<View>*<sp/><sp/>e<sp/>=<sp/>*p;</highlight></codeline>
|
|
<codeline lineno="134"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">do</highlight><highlight class="normal"><sp/>{</highlight></codeline>
|
|
<codeline lineno="135"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(e->val(x)->val()<sp/><<sp/>r.min())<sp/>{</highlight></codeline>
|
|
<codeline lineno="136"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Skip<sp/>edge</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="137"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>e->unlink();<sp/>e->mark();</highlight></codeline>
|
|
<codeline lineno="138"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>e<sp/>=<sp/>e->next_edge();</highlight></codeline>
|
|
<codeline lineno="139"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="140"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*p<sp/>=<sp/>e;</highlight></codeline>
|
|
<codeline lineno="141"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>assert(r.min()<sp/>==<sp/>e->val(x)->val());</highlight></codeline>
|
|
<codeline lineno="142"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>This<sp/>edges<sp/>must<sp/>be<sp/>kept</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="143"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(</highlight><highlight class="keywordtype">unsigned</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>j=r.width();<sp/>j--;<sp/>)<sp/>{</highlight></codeline>
|
|
<codeline lineno="144"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>e-><ref refid="classGecode_1_1Region_1ab6fb7233ea7822b457558d78d808a46c" kindref="member">free</ref>();</highlight></codeline>
|
|
<codeline lineno="145"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>p<sp/>=<sp/>e->next_edge_ref();</highlight></codeline>
|
|
<codeline lineno="146"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>e<sp/>=<sp/>e->next_edge();</highlight></codeline>
|
|
<codeline lineno="147"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="148"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>++r;</highlight></codeline>
|
|
<codeline lineno="149"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(r());</highlight></codeline>
|
|
<codeline lineno="150"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*p<sp/>=<sp/>NULL;</highlight></codeline>
|
|
<codeline lineno="151"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(e<sp/>!=<sp/>NULL)<sp/>{</highlight></codeline>
|
|
<codeline lineno="152"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>e->unlink();<sp/>e->mark();</highlight></codeline>
|
|
<codeline lineno="153"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>e<sp/>=<sp/>e->next_edge();</highlight></codeline>
|
|
<codeline lineno="154"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="155"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(m->marked())<sp/>{</highlight></codeline>
|
|
<codeline lineno="156"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Matching<sp/>has<sp/>been<sp/>deleted!</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="157"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>m->val(x)->matching(NULL);</highlight></codeline>
|
|
<codeline lineno="158"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>re.<ref refid="classGecode_1_1Support_1_1StaticStack_1aa4163f1b6a52870024cc02baf5d72259" kindref="member">push</ref>(x);</highlight></codeline>
|
|
<codeline lineno="159"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="160"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x->update();</highlight></codeline>
|
|
<codeline lineno="161"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
|
|
<codeline lineno="162"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Just<sp/>free<sp/>edges</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="163"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(Edge<View>*<sp/>e<sp/>=<sp/>x->val_edges();<sp/>e<sp/>!=<sp/>NULL;<sp/>e<sp/>=<sp/>e->next_edge())</highlight></codeline>
|
|
<codeline lineno="164"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>e->free();</highlight></codeline>
|
|
<codeline lineno="165"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="166"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="167"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="168"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">typename</highlight><highlight class="normal"><sp/><ref refid="classGecode_1_1Support_1_1StaticStack" kindref="compound">ViewValGraph::Graph<View>::ViewNodeStack</ref><sp/>m(r,n_view);</highlight></codeline>
|
|
<codeline lineno="169"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(!re.<ref refid="classGecode_1_1Support_1_1StaticStack_1a02834b1075e03ece518fa4edd35a6543" kindref="member">empty</ref>())</highlight></codeline>
|
|
<codeline lineno="170"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!match(m,re.<ref refid="classGecode_1_1Support_1_1StaticStack_1a0f3dcf1d3600548d935de5569aac8f6e" kindref="member">pop</ref>()))</highlight></codeline>
|
|
<codeline lineno="171"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">false</highlight><highlight class="normal">;</highlight></codeline>
|
|
<codeline lineno="172"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">true</highlight><highlight class="normal">;</highlight></codeline>
|
|
<codeline lineno="173"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="174"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="175"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="176"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">template</highlight><highlight class="normal"><</highlight><highlight class="keyword">class</highlight><highlight class="normal"><sp/>View></highlight></codeline>
|
|
<codeline lineno="177"><highlight class="normal"><sp/><sp/>forceinline<sp/></highlight><highlight class="keywordtype">bool</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="178" refid="classGecode_1_1Int_1_1Distinct_1_1Graph_1adb60b0788d0257ae2a1ef3283ac25833" refkind="member"><highlight class="normal"><sp/><sp/><ref refid="classGecode_1_1Int_1_1Distinct_1_1Graph_1adb60b0788d0257ae2a1ef3283ac25833" kindref="member">Graph<View>::mark</ref>(<ref refid="classGecode_1_1Space" kindref="compound">Space</ref>&<sp/>home)<sp/>{</highlight></codeline>
|
|
<codeline lineno="179"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">using<sp/>namespace<sp/></highlight><highlight class="normal">ViewValGraph;</highlight></codeline>
|
|
<codeline lineno="180"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="181"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="classGecode_1_1Region" kindref="compound">Region</ref><sp/>r(home);</highlight></codeline>
|
|
<codeline lineno="182"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="183"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>n_view_visited<sp/>=<sp/>0;</highlight></codeline>
|
|
<codeline lineno="184"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
|
|
<codeline lineno="185"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Marks<sp/>all<sp/>edges<sp/>as<sp/>used<sp/>that<sp/>are<sp/>on<sp/>simple<sp/>paths<sp/>in<sp/>the<sp/>graph</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="186"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>that<sp/>start<sp/>from<sp/>a<sp/>free<sp/>(unmatched<sp/>node)<sp/>by<sp/>depth-first-search</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="187"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classGecode_1_1Support_1_1StaticStack" kindref="compound">Support::StaticStack<ValNode<View></ref>*,<ref refid="classGecode_1_1Region" kindref="compound">Region</ref>><sp/>visit(r,n_val);</highlight></codeline>
|
|
<codeline lineno="188"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline>
|
|
<codeline lineno="189"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Insert<sp/>all<sp/>free<sp/>nodes:<sp/>they<sp/>can<sp/>be<sp/>only<sp/>value<sp/>nodes<sp/>as<sp/>we</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="190"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>have<sp/>a<sp/>maximum<sp/>matching<sp/>covering<sp/>all<sp/>view<sp/>nodes</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="191"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__TaskModelIntCount_1ga1ed6f089699260b994a25197199337a4" kindref="member">count</ref>++;</highlight></codeline>
|
|
<codeline lineno="192"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
|
|
<codeline lineno="193"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ValNode<View>**<sp/>v<sp/>=<sp/>&val;</highlight></codeline>
|
|
<codeline lineno="194"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(*v<sp/>!=<sp/>NULL)</highlight></codeline>
|
|
<codeline lineno="195"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!(*v)->matching())<sp/>{</highlight></codeline>
|
|
<codeline lineno="196"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((*v)->empty())<sp/>{</highlight></codeline>
|
|
<codeline lineno="197"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*v<sp/>=<sp/>(*v)->next_val();</highlight></codeline>
|
|
<codeline lineno="198"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>n_val--;</highlight></codeline>
|
|
<codeline lineno="199"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
|
|
<codeline lineno="200"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(*v)->min<sp/>=<sp/><ref refid="group__TaskModelIntCount_1ga1ed6f089699260b994a25197199337a4" kindref="member">count</ref>;</highlight></codeline>
|
|
<codeline lineno="201"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>visit.<ref refid="classGecode_1_1Support_1_1StaticStack_1aa4163f1b6a52870024cc02baf5d72259" kindref="member">push</ref>(*v);</highlight></codeline>
|
|
<codeline lineno="202"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>v<sp/>=<sp/>(*v)->next_val_ref();</highlight></codeline>
|
|
<codeline lineno="203"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="204"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
|
|
<codeline lineno="205"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>v<sp/>=<sp/>(*v)->next_val_ref();</highlight></codeline>
|
|
<codeline lineno="206"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="207"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="208"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline>
|
|
<codeline lineno="209"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Invariant:<sp/>only<sp/>value<sp/>nodes<sp/>are<sp/>on<sp/>the<sp/>stack!</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="210"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(!visit.<ref refid="classGecode_1_1Support_1_1StaticStack_1a02834b1075e03ece518fa4edd35a6543" kindref="member">empty</ref>())<sp/>{</highlight></codeline>
|
|
<codeline lineno="211"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ValNode<View>*<sp/>n<sp/>=<sp/>visit.<ref refid="classGecode_1_1Support_1_1StaticStack_1a0f3dcf1d3600548d935de5569aac8f6e" kindref="member">pop</ref>();</highlight></codeline>
|
|
<codeline lineno="212"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(Edge<View>*<sp/>e<sp/>=<sp/>n->edge_fst();<sp/>e<sp/>!=<sp/>n->edge_lst();<sp/>e=e->next())<sp/>{</highlight></codeline>
|
|
<codeline lineno="213"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Get<sp/>the<sp/>value<sp/>node</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="214"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>e->use();</highlight></codeline>
|
|
<codeline lineno="215"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ViewNode<View>*<sp/>x<sp/>=<sp/>e->view(n);</highlight></codeline>
|
|
<codeline lineno="216"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(x->min<sp/><<sp/><ref refid="group__TaskModelIntCount_1ga1ed6f089699260b994a25197199337a4" kindref="member">count</ref>)<sp/>{</highlight></codeline>
|
|
<codeline lineno="217"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>n_view_visited++;</highlight></codeline>
|
|
<codeline lineno="218"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x->min<sp/>=<sp/><ref refid="group__TaskModelIntCount_1ga1ed6f089699260b994a25197199337a4" kindref="member">count</ref>;</highlight></codeline>
|
|
<codeline lineno="219"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>assert(x->edge_fst()->next()<sp/>==<sp/>x->edge_lst());</highlight></codeline>
|
|
<codeline lineno="220"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ValNode<View>*<sp/>m<sp/>=<sp/>x->edge_fst()->val(x);</highlight></codeline>
|
|
<codeline lineno="221"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x->edge_fst()->use();</highlight></codeline>
|
|
<codeline lineno="222"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(m->min<sp/><<sp/><ref refid="group__TaskModelIntCount_1ga1ed6f089699260b994a25197199337a4" kindref="member">count</ref>)<sp/>{</highlight></codeline>
|
|
<codeline lineno="223"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>m->min<sp/>=<sp/><ref refid="group__TaskModelIntCount_1ga1ed6f089699260b994a25197199337a4" kindref="member">count</ref>;</highlight></codeline>
|
|
<codeline lineno="224"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>visit.<ref refid="classGecode_1_1Support_1_1StaticStack_1aa4163f1b6a52870024cc02baf5d72259" kindref="member">push</ref>(m);</highlight></codeline>
|
|
<codeline lineno="225"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="226"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="227"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="228"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="229"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="230"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="231"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>If<sp/>all<sp/>view<sp/>nodes<sp/>have<sp/>been<sp/>visited,<sp/>also<sp/>all<sp/>edges<sp/>are<sp/>used!</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="232"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(n_view_visited<sp/><<sp/>n_view)<sp/>{</highlight></codeline>
|
|
<codeline lineno="233"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>scc(home);</highlight></codeline>
|
|
<codeline lineno="234"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">true</highlight><highlight class="normal">;</highlight></codeline>
|
|
<codeline lineno="235"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
|
|
<codeline lineno="236"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">false</highlight><highlight class="normal">;</highlight></codeline>
|
|
<codeline lineno="237"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="238"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="239"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="240"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">template</highlight><highlight class="normal"><</highlight><highlight class="keyword">class</highlight><highlight class="normal"><sp/>View></highlight></codeline>
|
|
<codeline lineno="241"><highlight class="normal"><sp/><sp/>forceinline<sp/><ref refid="namespaceGecode_1ab278aee34126d2f13c5429ee3c4ed3b5" kindref="member">ExecStatus</ref></highlight></codeline>
|
|
<codeline lineno="242" refid="classGecode_1_1Int_1_1Distinct_1_1Graph_1a688eb25f2df6f03b1e70926564faddbd" refkind="member"><highlight class="normal"><sp/><sp/><ref refid="classGecode_1_1Int_1_1Distinct_1_1Graph_1a688eb25f2df6f03b1e70926564faddbd" kindref="member">Graph<View>::prune</ref>(<ref refid="classGecode_1_1Space" kindref="compound">Space</ref>&<sp/>home,<sp/></highlight><highlight class="keywordtype">bool</highlight><highlight class="normal">&<sp/>assigned)<sp/>{</highlight></codeline>
|
|
<codeline lineno="243"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">using<sp/>namespace<sp/></highlight><highlight class="normal">ViewValGraph;</highlight></codeline>
|
|
<codeline lineno="244"><highlight class="normal"><sp/><sp/><sp/><sp/>assigned<sp/>=<sp/></highlight><highlight class="keyword">false</highlight><highlight class="normal">;</highlight></codeline>
|
|
<codeline lineno="245"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Tell<sp/>constraints<sp/>and<sp/>also<sp/>eliminate<sp/>nodes<sp/>and<sp/>edges</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="246"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i<sp/>=<sp/>n_view;<sp/>i--;<sp/>)<sp/>{</highlight></codeline>
|
|
<codeline lineno="247"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ViewNode<View>*<sp/>x<sp/>=<sp/>view[i];</highlight></codeline>
|
|
<codeline lineno="248"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!x->edge_fst()->used(x))<sp/>{</highlight></codeline>
|
|
<codeline lineno="249"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>GECODE_ME_CHECK(x->view().eq(home,x->edge_fst()->val(x)->val()));</highlight></codeline>
|
|
<codeline lineno="250"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x->edge_fst()->val(x)->matching(NULL);</highlight></codeline>
|
|
<codeline lineno="251"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(Edge<View>*<sp/>e<sp/>=<sp/>x->val_edges();<sp/>e<sp/>!=<sp/>NULL;<sp/>e<sp/>=<sp/>e->next_edge())</highlight></codeline>
|
|
<codeline lineno="252"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>e->unlink();</highlight></codeline>
|
|
<codeline lineno="253"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>view[i]<sp/>=<sp/>view[--n_view];</highlight></codeline>
|
|
<codeline lineno="254"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>assigned<sp/>=<sp/></highlight><highlight class="keyword">true</highlight><highlight class="normal">;</highlight></codeline>
|
|
<codeline lineno="255"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
|
|
<codeline lineno="256"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>IterPruneVal<View><sp/>pv(view[i]);</highlight></codeline>
|
|
<codeline lineno="257"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>GECODE_ME_CHECK(view[i]->view().minus_v(home,pv,</highlight><highlight class="keyword">false</highlight><highlight class="normal">));</highlight></codeline>
|
|
<codeline lineno="258"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="259"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="260"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="namespaceGecode_1ab278aee34126d2f13c5429ee3c4ed3b5a01d6fb1ec70479e8e413d5ecfd63e303" kindref="member">ES_OK</ref>;</highlight></codeline>
|
|
<codeline lineno="261"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
|
|
<codeline lineno="262"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="263"><highlight class="normal">}}}</highlight></codeline>
|
|
<codeline lineno="264"><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="265"><highlight class="normal"></highlight><highlight class="comment">//<sp/>STATISTICS:<sp/>int-prop</highlight><highlight class="normal"></highlight></codeline>
|
|
<codeline lineno="266"><highlight class="normal"></highlight></codeline>
|
|
</programlisting>
|
|
<location file="/usr/include/gecode/int/distinct/graph.hpp"/>
|
|
</compounddef>
|
|
</doxygen>
|