a.binder 9 лет назад
Родитель
Сommit
cbc010be03
1 измененных файлов с 30 добавлено и 9 удалено
  1. 30 9
      SE/dev/php-cli/edge_paths_with_PE_controll.xsl

+ 30 - 9
SE/dev/php-cli/edge_paths_with_PE_controll.xsl

@@ -450,11 +450,23 @@
                                             [xslt]                         
                                             [xslt] /Users/a.binder/Documents/biuro.biall-net.pl-gitlab-se-2015-02-16.git/SE/dev/php-cli/edge_paths_with_PE_controll.xsl:571: Fatal Error! Cannot convert string to double: ""
                                             [xslt] Failed to process /Users/a.binder/Documents/biuro.biall-net.pl-gitlab-se-2015-02-16.git/SE/dev/php-cli/edge_joins_filled_paths.xml</disabled>-->
+                                          
+                                            <xsl:variable name="IfPathsCrossed" >
+                                                <xsl:choose>
+                                                    <xsl:when test="$candidates/bp:Path_Point/PathsCrossed[@NeighJoin_way_up_ID_Join or @NeighJoin_way_dn_ID_Join]">
+                                                        <xsl:message>#534 there are PathsCrossed - allow to decrease -1</xsl:message>
+                                                        <xsl:value-of select="0"/>
+                                                    </xsl:when>
+                                                    <xsl:otherwise><xsl:value-of select="1"/></xsl:otherwise>
+                                                </xsl:choose>
+                                            </xsl:variable>
+      
                                         <xsl:call-template name="calculate_optimum">
                                             <xsl:with-param name="candidates" select="$candidates"/>
                                             <xsl:with-param name="elements_cnt" select="count($candidates/bp:Path_Point)"/>
                                             <xsl:with-param name="max_bit" select="$max_bit"/>
                                             <xsl:with-param name="poprzednie_odpalam_liczenie_or_nie" select="$poprzednie_odpalam_liczenie_or_nie/poprzednie_odpalam_liczenie_or_nie"/>
+                                            <xsl:with-param name="variant" select="$IfPathsCrossed"/>
                                         </xsl:call-template>
                                     </odpalam_liczenie>
                                 </xsl:when>
@@ -538,7 +550,11 @@
         <xsl:param name="max_bit" required="yes"/>
         <xsl:param name="best_cost"/><xsl:param name="best_variant"/>
         <xsl:param name="poprzednie_odpalam_liczenie_or_nie"/>
+        <xsl:param name="PathsCrossed" select="0"/><!-- do jednorazowego wyzwolenia przez fukcje, aby tylko raz odjelo wariant zerowy -->
+        
+      
         <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="number(@distance)"/>-->
@@ -546,7 +562,8 @@
                     <!--<xsl:attribute name="bit" select="$bit"/>-->
                     <xsl:attribute name="bin_pos"  select="substring($bit, position(),1)"/>
                     <xsl:copy-of select="@*"/>
-                    <xsl:copy-of select="bp:Path_Point"></xsl:copy-of>
+                    <!--<xsl:copy-of select="bp:Path_Point"/>-->
+                    <xsl:copy-of select="PathsCrossed"/>
                 </bp:Path_Point>
             </xsl:for-each>
         </xsl:variable>
@@ -605,7 +622,7 @@
                                 <!--<xsl:attribute name="bit" select="$bit"/>-->
                                 <xsl:attribute name="bin_pos"  select="substring($best_variant, position(),1)"/>
                                 <xsl:copy-of select="@*"/>
-                                <xsl:copy-of select="bp:Path_Point"></xsl:copy-of>
+                                <xsl:copy-of select="bp:Path_Point"/>
                             </bp:Path_Point>
                         </xsl:for-each>
                     </xsl:variable>
@@ -683,17 +700,19 @@
             <xsl:for-each select="$cand_to_calc/bp:Path_Point">
                     <xsl:variable name="PathCrossLast" select="position() = last()"/>
                     <xsl:for-each select="PathsCrossed[@NeighJoin_way_up_ID_Join]">
-                        <xsl:message>#681: PathsCrossed up $PathCrossLast=<xsl:value-of select="$PathCrossLast"/>; to up:<xsl:value-of select="@NeighJoin_way_up_ID_Join"/>;</xsl:message>
+                        <xsl:message>#681: PathsCrossed up $PathCrossLast=<xsl:value-of select="$PathCrossLast"/>; to up:<xsl:value-of select="@NeighJoin_way_up_ID_Join"/>; @NeighJoin_way_up_len=<xsl:value-of select="@NeighJoin_way_up_len"/></xsl:message>
                         <bp:Path_Point>
                             <xsl:attribute name="poprzednia_grupa" select="true()"/>
                             <xsl:attribute name="bin_pos" select="1"/>
                             <xsl:attribute name="ID_Join" select="@NeighJoin_way_up_ID_Join"/>
                             <xsl:choose>
                                 <xsl:when test="$PathCrossLast">
-                                    <xsl:attribute name="distance" select="number(parent::node()/@distance) + number(@distance)"/>
+                                    <xsl:message>adding distance to local:<xsl:value-of select="number(parent::node()/@distance)"/>== <xsl:value-of select="number(parent::node()/@distance) + number(@NeighJoin_way_up_len)"/>; </xsl:message>
+                                    <xsl:attribute name="distance" select="number(parent::node()/@distance) + number(@NeighJoin_way_up_len)"/>
                                 </xsl:when>
                                 <xsl:otherwise>
-                                    <xsl:attribute name="distance" select="number(parent::node()/@distance) - number(@distance)"/>
+                                    <xsl:message>reducing distance to local:<xsl:value-of select="number(parent::node()/@distance)"/>== <xsl:value-of select="number(parent::node()/@distance) - number(@NeighJoin_way_up_len)"/>; </xsl:message>
+                                    <xsl:attribute name="distance" select="number(parent::node()/@distance) - number(@NeighJoin_way_up_len)"/>
                                 </xsl:otherwise>
                             </xsl:choose>
                             <xsl:attribute name="pos" select="-1"/>
@@ -703,17 +722,19 @@
             <xsl:for-each select="$cand_to_calc/bp:Path_Point">
                 <xsl:variable name="PathCrossLast" select="position() = last()"/>
                 <xsl:for-each select="PathsCrossed[@NeighJoin_way_dn_ID_Join]">
-                    <xsl:message>#681: PathsCrossed dwn  $PathCrossLast=<xsl:value-of select="$PathCrossLast"/>; to up:<xsl:value-of select="@NeighJoin_way_dn_ID_Join"/>;</xsl:message>
+                    <xsl:message>#681: PathsCrossed dwn  $PathCrossLast=<xsl:value-of select="$PathCrossLast"/>; to up:<xsl:value-of select="@NeighJoin_way_dn_len"/>; @distance=<xsl:value-of select="@NeighJoin_way_dn_len"/>; </xsl:message>
                     <bp:Path_Point>
                         <xsl:attribute name="poprzednia_grupa" select="true()"/>
                         <xsl:attribute name="bin_pos" select="1"/>
                         <xsl:attribute name="ID_Join" select="@NeighJoin_way_dn_ID_Join"/>
                         <xsl:choose>
                             <xsl:when test="$PathCrossLast">
-                                <xsl:attribute name="distance" select="number(parent::node()/@distance) + number(@distance)"/>
+                                <xsl:message>adding distance to local:<xsl:value-of select="number(parent::node()/@distance)"/>== <xsl:value-of select="number(parent::node()/@distance) + number(@NeighJoin_way_dn_len)"/>; </xsl:message>
+                                <xsl:attribute name="distance" select="number(parent::node()/@distance) + number(@NeighJoin_way_dn_len)"/>
                             </xsl:when>
                             <xsl:otherwise>
-                                <xsl:attribute name="distance" select="number(parent::node()/@distance) - number(@distance)"/>
+                                <xsl:message>reducing distance to local:<xsl:value-of select="number(parent::node()/@distance)"/>== <xsl:value-of select="number(parent::node()/@distance) - number(@NeighJoin_way_dn_len)"/>; </xsl:message>
+                                <xsl:attribute name="distance" select="number(parent::node()/@distance) - number(@NeighJoin_way_dn_len)"/>
                             </xsl:otherwise>
                         </xsl:choose>
                         <xsl:attribute name="pos" select="-1"/>
@@ -784,7 +805,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="$ID_Join_dn"/>
+                                     <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>