|
|
@@ -170,7 +170,7 @@
|
|
|
<xsl:variable name="NeighJoin_pos" select="$PathsCrossed/PathsCrossed/Ways[@ID_WAY= current()/@ID_WAY]/(bp:Path_Point)[@ID_Join= $Joining_ID_Join_from]/@pos"/>
|
|
|
<xsl:variable name="NeighJoin_pos_distance" select="number($PathsCrossed/PathsCrossed/Ways[@ID_WAY= current()/@ID_WAY]/(bp:Path_Point)[@pos= $NeighJoin_pos]/@distance)"/>
|
|
|
<xsl:attribute name="NeighJoin_pos" select="$NeighJoin_pos"/>
|
|
|
- <xsl:attribute name="NeighJoin_pos_distance" select="$NeighJoin_pos_distance"/>
|
|
|
+ <!--<xsl:attribute name="NeighJoin_pos_distance" select="$NeighJoin_pos_distance"/>-->
|
|
|
<xsl:attribute name="Deb_Cur_ID_WAY" select="@ID_WAY"/>
|
|
|
<xsl:attribute name="Joining_ID_Join_from" select="$Joining_ID_Join_from"/>
|
|
|
|
|
|
@@ -536,7 +536,7 @@
|
|
|
<xsl:template match="edge_paths_with_PE_controll|Path|PointMatrixGroupPE|PointMatrixGroup|odpalam_liczenie|koniec_wariantow" mode="PathsCrossed">
|
|
|
<xsl:apply-templates mode="PathsCrossed"/>
|
|
|
</xsl:template>
|
|
|
- <xsl:template match="bp:Path_Point_Cable|bp:Path_Point" mode="PathsCrossed">
|
|
|
+ <xsl:template match="bp:Path_Point" mode="PathsCrossed"> <!-- nie potrzebujemy kabli ! bp:Path_Point_Cable-->
|
|
|
<xsl:copy-of select="."/>
|
|
|
</xsl:template>
|
|
|
<xsl:template match="*|text()" mode="PathsCrossed"/>
|
|
|
@@ -563,7 +563,7 @@
|
|
|
<!--<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 select="bp:Path_Point"/>-->
|
|
|
<xsl:copy-of select="PathsCrossed"/>
|
|
|
</bp:Path_Point>
|
|
|
</xsl:for-each>
|
|
|
@@ -609,71 +609,76 @@
|
|
|
</xsl:otherwise>
|
|
|
</xsl:choose>
|
|
|
</xsl:variable>
|
|
|
- <xsl:if test=" number($debug) > 3 "><xsl:copy-of select="$best"/></xsl:if>
|
|
|
+ <xsl:if test=" number($debug) > 3 ">
|
|
|
+ <xsl:copy-of select="$best"/>
|
|
|
+ <xsl:message>#688 (C$<xsl:value-of select="$cost_sum/costs/@Cable_Price"/>+P$<xsl:value-of select="$cost_sum/costs/@PE_Price"/> =<xsl:value-of select="$cost_sum/costs/@Price"/>) v:<xsl:value-of select="$variant"/>; b:<xsl:value-of select="$bit"/>; bestV=<xsl:value-of select="$best_variant"/>; bestC=<xsl:value-of select="$best_cost"/> </xsl:message>
|
|
|
+ </xsl:if>
|
|
|
<xsl:choose>
|
|
|
<xsl:when test="$bit = $max_bit">
|
|
|
<koniec_wariantow>
|
|
|
- <xsl:message>#410 OK - przeliczony wariant bit=<xsl:value-of select="$best_variant"/> ( nr <xsl:value-of select="$variant"/>;) </xsl:message>
|
|
|
+ <xsl:message>#410 OK - cost:<xsl:value-of select="$best_cost"/>; bit=<xsl:value-of select="$best_variant"/> ( nr <xsl:value-of select="$variant"/>;) </xsl:message>
|
|
|
<xsl:attribute name="best_variant" select="$best_variant"/>
|
|
|
<!-- trzeba przygotowac stary set dla best do pokazania kabli -->
|
|
|
- <xsl:variable name="cand_to_calc_best">
|
|
|
+ <xsl:variable name="cand_to_calc_best">
|
|
|
+ <xsl:for-each select="$candidates/bp:Path_Point">
|
|
|
+ <!--<xsl:sort select="@distance"/>-->
|
|
|
+ <bp:Path_Point>
|
|
|
+ <!--<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"/>
|
|
|
+ </bp:Path_Point>
|
|
|
+ </xsl:for-each>
|
|
|
+ </xsl:variable>
|
|
|
+ <xsl:variable name="show_cables">
|
|
|
+ <xsl:call-template name="calc_cost_way">
|
|
|
+ <xsl:with-param name="cand_to_calc" select="$cand_to_calc_best"/>
|
|
|
+ <xsl:with-param name="poprzednie_odpalam_liczenie_or_nie" select="$poprzednie_odpalam_liczenie_or_nie"/>
|
|
|
+ <xsl:with-param name="show_cables" select="1"/>
|
|
|
+ </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="$bit"/>-->
|
|
|
- <xsl:attribute name="bin_pos" select="substring($best_variant, position(),1)"/>
|
|
|
- <xsl:copy-of select="@*"/>
|
|
|
- <xsl:copy-of select="bp:Path_Point"/>
|
|
|
- </bp:Path_Point>
|
|
|
- </xsl:for-each>
|
|
|
- </xsl:variable>
|
|
|
- <xsl:variable name="show_cables">
|
|
|
- <xsl:call-template name="calc_cost_way">
|
|
|
- <xsl:with-param name="cand_to_calc" select="$cand_to_calc_best"/>
|
|
|
- <xsl:with-param name="poprzednie_odpalam_liczenie_or_nie" select="$poprzednie_odpalam_liczenie_or_nie"/>
|
|
|
- <xsl:with-param name="show_cables" select="1"/>
|
|
|
- </xsl:call-template>
|
|
|
- </xsl:variable>
|
|
|
- <xsl:for-each select="$candidates/bp:Path_Point">
|
|
|
- <!--<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"/>
|
|
|
- <xsl:attribute name="bin_pos" select="substring($best_variant, position(),1)"/>
|
|
|
- <xsl:copy-of select="@*"/>
|
|
|
- <xsl:attribute name="Price" select="$best_cost"/>
|
|
|
- <xsl:copy-of select="bp:Path_Point"/>
|
|
|
- </bp:Path_Point>
|
|
|
- </xsl:if>
|
|
|
- <xsl:if test="substring($best_variant, position(),1)='0'"><!-- wyznaczenie od razu kabla -->
|
|
|
- <bp:Path_Point_Cable>
|
|
|
<xsl:attribute name="bit" select="$best_variant"/>
|
|
|
<xsl:attribute name="bin_pos" select="substring($best_variant, position(),1)"/>
|
|
|
<xsl:copy-of select="@*"/>
|
|
|
<xsl:attribute name="Price" select="$best_cost"/>
|
|
|
- <xsl:attribute name="Target_ID_Join" select="$show_cables/cost[@ID_Join = current()/@ID_Join]/@Target_ID_Join"/>
|
|
|
- <!-- todo do jakiego Join zostal przybity -->
|
|
|
<xsl:copy-of select="bp:Path_Point"/>
|
|
|
- <!--<xsl:if test="$debug">
|
|
|
- <debug_show_cables>
|
|
|
- <xsl:copy-of select="$show_cables"></xsl:copy-of>
|
|
|
- </debug_show_cables>
|
|
|
- </xsl:if>-->
|
|
|
- </bp:Path_Point_Cable>
|
|
|
+ </bp:Path_Point>
|
|
|
</xsl:if>
|
|
|
- </xsl:for-each>
|
|
|
+ <xsl:if test="substring($best_variant, position(),1)='0'"><!-- wyznaczenie od razu kabla -->
|
|
|
+ <bp:Path_Point_Cable>
|
|
|
+ <xsl:attribute name="bit" select="$best_variant"/>
|
|
|
+ <xsl:attribute name="bin_pos" select="substring($best_variant, position(),1)"/>
|
|
|
+ <xsl:copy-of select="@*"/>
|
|
|
+ <xsl:attribute name="Price" select="$best_cost"/>
|
|
|
+ <xsl:attribute name="Target_ID_Join" select="$show_cables/cost[@ID_Join = current()/@ID_Join]/@Target_ID_Join"/>
|
|
|
+ <!-- todo do jakiego Join zostal przybity -->
|
|
|
+ <xsl:copy-of select="bp:Path_Point"/>
|
|
|
+ <!-- <xsl:if test="$debug">-->
|
|
|
+ <debug_show_cables>
|
|
|
+ <xsl:copy-of select="$show_cables/cost[@ID_Join= current()/@ID_Join]"/>
|
|
|
+ </debug_show_cables>
|
|
|
+ <!--</xsl:if>-->
|
|
|
+ </bp:Path_Point_Cable>
|
|
|
+ </xsl:if>
|
|
|
+ </xsl:for-each>
|
|
|
</koniec_wariantow>
|
|
|
</xsl:when>
|
|
|
<xsl:otherwise>
|
|
|
- <xsl:call-template name="calculate_optimum">
|
|
|
- <xsl:with-param name="candidates" select="$candidates"/>
|
|
|
- <xsl:with-param name="max_bit" select="$max_bit"/>
|
|
|
- <xsl:with-param name="variant" select="$variant + 1"/>
|
|
|
- <xsl:with-param name="elements_cnt" select="$elements_cnt"/>
|
|
|
- <xsl:with-param name="best_cost" select="$best/best/@best_cost"/>
|
|
|
- <xsl:with-param name="best_variant" select="$best/best/@best_variant"/>
|
|
|
- <xsl:with-param name="poprzednie_odpalam_liczenie_or_nie" select="$poprzednie_odpalam_liczenie_or_nie"/>
|
|
|
- </xsl:call-template>
|
|
|
+ <!--<xsl:if test="$variant < 10 ">--><!-- debug limit -->
|
|
|
+ <xsl:call-template name="calculate_optimum">
|
|
|
+ <xsl:with-param name="candidates" select="$candidates"/>
|
|
|
+ <xsl:with-param name="max_bit" select="$max_bit"/>
|
|
|
+ <xsl:with-param name="variant" select="$variant + 1"/>
|
|
|
+ <xsl:with-param name="elements_cnt" select="$elements_cnt"/>
|
|
|
+ <xsl:with-param name="best_cost" select="$best/best/@best_cost"/>
|
|
|
+ <xsl:with-param name="best_variant" select="$best/best/@best_variant"/>
|
|
|
+ <xsl:with-param name="poprzednie_odpalam_liczenie_or_nie" select="$poprzednie_odpalam_liczenie_or_nie"/>
|
|
|
+ </xsl:call-template>
|
|
|
+ <!--</xsl:if>-->
|
|
|
</xsl:otherwise>
|
|
|
</xsl:choose>
|
|
|
</xsl:template>
|
|
|
@@ -700,20 +705,24 @@
|
|
|
|
|
|
<xsl:for-each select="$cand_to_calc/bp:Path_Point">
|
|
|
<xsl:variable name="PathCrossLast" select="position() = last()"/>
|
|
|
+ <xsl:variable name="PathCrossFirst" select="position() = 1"/>
|
|
|
<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"/>; @NeighJoin_way_up_len=<xsl:value-of select="@NeighJoin_way_up_len"/></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: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:message>adding distance to local from:<xsl:value-of select="number(parent::node()/@distance)"/>; to:<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: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:when test="$PathCrossFirst">
|
|
|
+ <!--<xsl:message>reducing distance to local:from:<xsl:value-of select="number(parent::node()/@distance)"/>; to: <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:message terminate="yes">#720 dowiazanie Crossed w srodku grupy</xsl:message>
|
|
|
</xsl:otherwise>
|
|
|
</xsl:choose>
|
|
|
<xsl:attribute name="pos" select="-1"/>
|
|
|
@@ -723,7 +732,7 @@
|
|
|
<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_len"/>; @distance=<xsl:value-of select="@NeighJoin_way_dn_len"/>; </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"/>
|
|
|
@@ -754,6 +763,7 @@
|
|
|
</xsl:if>
|
|
|
<xsl:for-each select="$candidates_merged_with_poprzednie/bp:Path_Point"> <!-- bylo cand_to_calc -->
|
|
|
<xsl:sort select="number(@distance)"/>
|
|
|
+ <!--<xsl:message>#764 test @distance=<xsl:value-of select="@distance"/>; z @bin_pos=<xsl:value-of select="@bin_pos"/>; @distance=<xsl:value-of select="@distance"/>;@id_path=<xsl:value-of select="@id_path"/> </xsl:message>-->
|
|
|
<xsl:variable name="CurDist" select="@distance"/> <!-- do wykorzystania w zalaeznosciach z jednej drogi do przylaczonej -->
|
|
|
<xsl:choose>
|
|
|
<xsl:when test="@poprzednia_grupa">
|
|
|
@@ -764,25 +774,26 @@
|
|
|
<xsl:attribute name="debug" select="'ignore by last DistGroup @poprzednia_grupa'"/>
|
|
|
</cost>
|
|
|
</xsl:when>
|
|
|
- <xsl:when test="number(string-length(@bin_pos))=0">
|
|
|
+ <!--<xsl:when test="number(string-length(@bin_pos))=0">
|
|
|
<xsl:message>#768 debug @bin_pos=<xsl:value-of select="@bin_pos"/>; </xsl:message>
|
|
|
- </xsl:when>
|
|
|
+ </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 number(@distance) < current()/number(@distance )]/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_id" select="max($candidates_merged_with_poprzednie/bp:Path_Point[@bin_pos=1 and number(@distance) < current()/number(@distance )]/number(@ID_Join))"/>
|
|
|
+ <!--<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_path=$way_up_id]/@distance)"/></xsl:when>
|
|
|
+ <xsl:value-of select="number( current()/@distance) - number($candidates_merged_with_poprzednie/bp:Path_Point[@ID_Join=$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 number(@distance) > current()/number(@distance) ]/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_id" select="max($candidates_merged_with_poprzednie/bp:Path_Point[@bin_pos=1 and number(@distance) > current()/number(@distance) ]/number(@ID_Join)) " />
|
|
|
+ <!--<xsl:variable name="ID_Join_dn" select="$candidates_merged_with_poprzednie/bp:Path_Point[@ID_Join =$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_path=$way_dn_id]/@distance ) - current()/number(@distance)"/>
|
|
|
+ <xsl:value-of select=" number( $candidates_merged_with_poprzednie/bp:Path_Point[@ID_Join=$way_dn_id]/@distance ) - current()/number(@distance)"/>
|
|
|
</xsl:when>
|
|
|
<xsl:otherwise><xsl:value-of select="-1"/></xsl:otherwise>
|
|
|
</xsl:choose>
|
|
|
@@ -808,7 +819,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="$way_dn_id"/>
|
|
|
<xsl:attribute name="ID_Join" select="@ID_Join"/>
|
|
|
<xsl:attribute name="Cable_Price" select="$Cable_Price_sum"/>
|
|
|
</xsl:if>
|
|
|
@@ -834,7 +845,7 @@
|
|
|
<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="$ID_Join_up"/>
|
|
|
+ <xsl:attribute name="Target_ID_Join" select="$way_up_id"/>
|
|
|
<xsl:attribute name="ID_Join" select="@ID_Join"/>
|
|
|
</xsl:if>
|
|
|
<xsl:attribute name="Price" select="$Cable_Price_sum"/>
|