Kaynağa Gözat

blad sortowania i target z ID_JOin costu

a.binder 9 yıl önce
ebeveyn
işleme
fefe4e767d

+ 15 - 13
SE/dev/php-cli/edge_paths_with_PE_controll.xsl

@@ -18,7 +18,7 @@
     <xsl:param name="logic" select="'grouped'"/> <!-- tutaj robi grupy po $max_combinate_groups_elements -->
     <!--<xsl:param name="logic" select="'sorted'"/>--> <!-- tutaj robi grupy ale analizyje w grupie tylko wazniejsze/bardziej oblozone wezly -->
     
-    <xsl:param name="debug" />
+    <xsl:param name="debug" select="0" />
     
     
     <!--<xsl:param name="edge_paths_with_PE.xml"/>-->
@@ -293,7 +293,7 @@
                 <!-- ida kandydaci -->
                         <xsl:variable name="candidates">
                             <xsl:for-each select="distance2[ (  $logic='sorted' and ( ( position() &lt;= $bit_max_Pos and @point_count &gt;0 ) or (  position()=1 and $point_count_Pos &gt; 0 )  ) or position()= last()  )   or ( @point_count &gt;0 and $logic='grouped'  )  ]">  <!--@point_count &gt;0-->  <!--( position() &lt;= $bit_max_Pos and @point_count &gt;0 ) or (  position()=1 and $point_count_Pos &gt; 0 )  or position()= last() --> <!-- jak jest maly wspolczynnik to chociaz jeden punkt jak sa punkty jakies w tej grupie -->
-                                    <xsl:sort select="@cost_dist" order="descending"/>
+                                    <!--<xsl:sort select="@cost_dist" order="descending"/>-->
                                     <bp:Path_Point>
                                         <xsl:copy-of select="@ID_Join"/>
                                         <xsl:attribute name="DebugPosPoint" select="position()"/>
@@ -415,7 +415,7 @@
         <xsl:variable name="bit" select=" string-join(bp:decimalToBitFill($variant,$elements_cnt),'')"/>
         <xsl:variable name="cand_to_calc">
             <xsl:for-each select="$candidates/bp:Path_Point">
-                <xsl:sort select="@distance"/>
+                <!--<xsl:sort select="number(@distance)"/>-->
                 <bp:Path_Point>
                     <!--<xsl:attribute name="bit" select="$bit"/>-->
                     <xsl:attribute name="bin_pos"  select="substring($bit, position(),1)"/>
@@ -474,7 +474,7 @@
                     <!-- trzeba przygotowac stary set dla best do pokazania kabli -->
                     <xsl:variable name="cand_to_calc_best">
                         <xsl:for-each select="$candidates/bp:Path_Point">
-                            <xsl:sort select="@distance"/>
+                            <!--<xsl:sort select="@distance"/>-->
                             <bp:Path_Point>
                                 <!--<xsl:attribute name="bit" select="$bit"/>-->
                                 <xsl:attribute name="bin_pos"  select="substring($best_variant, position(),1)"/>
@@ -491,7 +491,7 @@
                         </xsl:call-template>
                     </xsl:variable>
                     <xsl:for-each select="$candidates/bp:Path_Point">
-                    <xsl:sort select="@distance"/>
+                    <!--<xsl:sort select="number(@distance)"/>-->
                     <xsl:if test="substring($best_variant, position(),1)='1'"><!-- jak wystawiony w wariancie-->
                         <bp:Path_Point>
                             <xsl:attribute name="bit" select="$best_variant"/>
@@ -552,7 +552,7 @@
             </xsl:for-each>
             <!--<xsl:copy-of select="$cand_to_calc/bp:Path_Point"/>-->
         </xsl:variable>
-        <xsl:if test="$debug">
+        <xsl:if test="number($debug) &gt;1">
                 <candidates_merged_with_poprzednie>
                     <cand_to_calc><xsl:copy-of select="$cand_to_calc"/></cand_to_calc>
                     <poprzedniee><xsl:copy-of select="$poprzednie_odpalam_liczenie_or_nie/poprzednie_odpalam_liczenie_or_nie"/></poprzedniee>
@@ -572,19 +572,21 @@
                     </cost>
                 </xsl:when>
                 <xsl:when test="@bin_pos=0"><!-- szukamy gdzie ma najblizej i za ile -->
-                    <xsl:variable name="way_up_id" select="max($candidates_merged_with_poprzednie/bp:Path_Point[@bin_pos=1 and @id_path &lt;  current()/@id_path ]/number(@ID_Join))"/>
+                    <xsl:variable name="way_up_id" select="max($candidates_merged_with_poprzednie/bp:Path_Point[@bin_pos=1 and number(@id_path) &lt;  current()/number(@id_path )]/number(@id_path))"/>
+                    <xsl:variable name="ID_Join_up" select="$candidates_merged_with_poprzednie/bp:Path_Point[@id_path =$way_up_id ]/@ID_Join"/>
                     <xsl:variable name="way_up_len" >
                             <xsl:choose>
                                 <xsl:when test="$way_up_id">
-                                    <xsl:value-of select="number( current()/@distance) - number($candidates_merged_with_poprzednie/bp:Path_Point[@ID_Join=$way_up_id]/@distance)"/></xsl:when>
+                                    <xsl:value-of select="number( current()/@distance) - number($candidates_merged_with_poprzednie/bp:Path_Point[@id_path=$way_up_id]/@distance)"/></xsl:when>
                                 <xsl:otherwise><xsl:value-of select="-1"/></xsl:otherwise>
                             </xsl:choose>
                     </xsl:variable>
-                    <xsl:variable name="way_dn_id" select="max($candidates_merged_with_poprzednie/bp:Path_Point[@bin_pos=1 and @id_path &gt;  current()/@id_path ]/number(@ID_Join)) " />
+                    <xsl:variable name="way_dn_id" select="max($candidates_merged_with_poprzednie/bp:Path_Point[@bin_pos=1 and number(@id_path) &gt;  current()/number(@id_path) ]/number(@id_path)) " />
+                    <xsl:variable name="ID_Join_dn" select="$candidates_merged_with_poprzednie/bp:Path_Point[@id_path =$way_dn_id ]/@ID_Join"/>
                     <xsl:variable name="way_dn_len">
                         <xsl:choose>
                             <xsl:when test="$way_dn_id">
-                                <xsl:value-of select=" number( $candidates_merged_with_poprzednie/bp:Path_Point[@ID_Join=$way_dn_id]/@distance ) -  current()/@distance"/>
+                                <xsl:value-of select=" number( $candidates_merged_with_poprzednie/bp:Path_Point[@id_path=$way_dn_id]/@distance ) -  current()/number(@distance)"/>
                             </xsl:when>
                             <xsl:otherwise><xsl:value-of select="-1"/></xsl:otherwise>
                         </xsl:choose>
@@ -610,7 +612,7 @@
                                      <xsl:attribute name="way_dn_id" select="$way_dn_id"/>
                                      <xsl:attribute name="way_dn_len" select="$way_dn_len"/>
                                      <xsl:attribute name="PE_Price" select="0"/>
-                                     <xsl:attribute name="Target_ID_Join" select="$way_dn_id"/>
+                                    <xsl:attribute name="Target_ID_Join" select="$ID_Join_dn"/>
                                      <xsl:attribute name="ID_Join" select="@ID_Join"/>
                                      <xsl:attribute name="Cable_Price" select="$Cable_Price_sum"/>
                                 </xsl:if>
@@ -629,14 +631,14 @@
                                         </xsl:otherwise>
                                     </xsl:choose>
                                 </xsl:variable>
-                                <xsl:if test="$show_cables">
+                                <xsl:if test="$show_cables or $debug">
                                     <xsl:attribute name="Cable_Price" select="$Cable_Price_sum"/> <!-- todo @point_count -->
                                     <xsl:attribute name="PE_Price" select="0"/>
                                     <xsl:attribute name="choosed" select="'up'"/>
                                     <xsl:attribute name="way_up_id" select="$way_up_id"/>
                                     <xsl:attribute name="way_up_len" select="$way_up_len"/>
                                     <xsl:attribute name="way_dn_len" select="$way_dn_len"/>
-                                    <xsl:attribute name="Target_ID_Join" select="$way_up_id"/>
+                                    <xsl:attribute name="Target_ID_Join" select="$ID_Join_up"/>
                                     <xsl:attribute name="ID_Join" select="@ID_Join"/>
                                 </xsl:if>
                                 <xsl:attribute name="Price" select="$Cable_Price_sum"/>

+ 6 - 1
SE/dev/php-cli/edge_paths_with_PE_controll_to_PE.xsl

@@ -65,7 +65,12 @@
     
     
     
-    
+    <xsl:template match="*" mode="edge_paths_with_PE.xml">
+        <xsl:message>Matched node not needed <xsl:value-of select="name()"/></xsl:message>
+    </xsl:template>
+    <xsl:template match="text()" mode="edge_paths_with_PE.xml">
+        <xsl:message>Matched text: <xsl:value-of select="."/></xsl:message>
+    </xsl:template>