|
@@ -14,7 +14,7 @@
|
|
|
|
|
|
|
|
<xsl:param name="PE_Price" select="2500"/>
|
|
<xsl:param name="PE_Price" select="2500"/>
|
|
|
<xsl:param name="Cable_Price" select="3"/>
|
|
<xsl:param name="Cable_Price" select="3"/>
|
|
|
- <xsl:param name="max_combinate_groups_elements" select="14"/> <!-- po ile wezlow mamy grupowac do wyliczania kombinacji kosztow -->
|
|
|
|
|
|
|
+ <xsl:param name="max_combinate_groups_elements" select="10"/> <!-- po ile wezlow mamy grupowac do wyliczania kombinacji kosztow -->
|
|
|
<xsl:param name="logic" select="'grouped'"/> <!-- tutaj robi grupy po $max_combinate_groups_elements -->
|
|
<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="logic" select="'sorted'"/>--> <!-- tutaj robi grupy ale analizyje w grupie tylko wazniejsze/bardziej oblozone wezly -->
|
|
|
|
|
|
|
@@ -88,6 +88,7 @@
|
|
|
<distance>
|
|
<distance>
|
|
|
<xsl:attribute name="pos" select="position()"/>
|
|
<xsl:attribute name="pos" select="position()"/>
|
|
|
<xsl:attribute name="not_id" select="@not_id"/>
|
|
<xsl:attribute name="not_id" select="@not_id"/>
|
|
|
|
|
+ <xsl:attribute name="ID_Join" select="@ID_Join"/>
|
|
|
<xsl:attribute name="len" select="@len"/>
|
|
<xsl:attribute name="len" select="@len"/>
|
|
|
<xsl:attribute name="id_path" select="@id_path"/>
|
|
<xsl:attribute name="id_path" select="@id_path"/>
|
|
|
<xsl:variable name="Points" select="count(Points)"/>
|
|
<xsl:variable name="Points" select="count(Points)"/>
|
|
@@ -114,6 +115,7 @@
|
|
|
<xsl:for-each select="$EconomicDistanceCut/EconomicDistanceCut/distance">
|
|
<xsl:for-each select="$EconomicDistanceCut/EconomicDistanceCut/distance">
|
|
|
<distance2>
|
|
<distance2>
|
|
|
<xsl:attribute name="distance" select="sum( $EconomicDistanceCut/EconomicDistanceCut/distance[number(@pos )< number(current()/@pos )]/@len)"/>
|
|
<xsl:attribute name="distance" select="sum( $EconomicDistanceCut/EconomicDistanceCut/distance[number(@pos )< number(current()/@pos )]/@len)"/>
|
|
|
|
|
+ <xsl:copy-of select="@ID_Join"/>
|
|
|
<!-- suma do poprzedniego pkt tylko dla tych co maja pkt-->
|
|
<!-- suma do poprzedniego pkt tylko dla tych co maja pkt-->
|
|
|
<xsl:choose>
|
|
<xsl:choose>
|
|
|
<xsl:when test="number(@point_count)>0">
|
|
<xsl:when test="number(@point_count)>0">
|
|
@@ -203,8 +205,10 @@
|
|
|
</distance2>
|
|
</distance2>
|
|
|
</xsl:for-each>
|
|
</xsl:for-each>
|
|
|
</EconomicDistanceCut2>-->
|
|
</EconomicDistanceCut2>-->
|
|
|
- <!--<xsl:copy-of select="$EconomicDistanceCut2"/>-->
|
|
|
|
|
-
|
|
|
|
|
|
|
+ <!-- debug -->
|
|
|
|
|
+ <!--<debug>
|
|
|
|
|
+ <xsl:copy-of select="$EconomicDistanceCut2"/>
|
|
|
|
|
+ </debug>-->
|
|
|
|
|
|
|
|
<xsl:variable name="elements_cnt" select="count($EconomicDistanceCut2/EconomicDistanceCut2/distance2[@point_count > 0])"/><!-- liczba wezlow potencjalnych licbza PE-->
|
|
<xsl:variable name="elements_cnt" select="count($EconomicDistanceCut2/EconomicDistanceCut2/distance2[@point_count > 0])"/><!-- liczba wezlow potencjalnych licbza PE-->
|
|
|
<!--<xsl:variable name="bit_max" select="round($len div ( $PE_Price div $Cable_Price ) + count($EconomicDistanceCut2/EconomicDistanceCut2/distance2[@cost_dist > $PE_Price]) )"/>--><!-- max licbza PE-->
|
|
<!--<xsl:variable name="bit_max" select="round($len div ( $PE_Price div $Cable_Price ) + count($EconomicDistanceCut2/EconomicDistanceCut2/distance2[@cost_dist > $PE_Price]) )"/>--><!-- max licbza PE-->
|
|
@@ -270,6 +274,7 @@
|
|
|
<xsl:for-each select="distance2[ ( $logic='sorted' and ( ( position() <= $bit_max_Pos and @point_count >0 ) or ( position()=1 and $point_count_Pos > 0 ) ) or position()= last() ) or ( @point_count >0 and $logic='grouped' ) ]"> <!--@point_count >0--> <!--( position() <= $bit_max_Pos and @point_count >0 ) or ( position()=1 and $point_count_Pos > 0 ) or position()= last() --> <!-- jak jest maly wspolczynnik to chociaz jeden punkt jak sa punkty jakies w tej grupie -->
|
|
<xsl:for-each select="distance2[ ( $logic='sorted' and ( ( position() <= $bit_max_Pos and @point_count >0 ) or ( position()=1 and $point_count_Pos > 0 ) ) or position()= last() ) or ( @point_count >0 and $logic='grouped' ) ]"> <!--@point_count >0--> <!--( position() <= $bit_max_Pos and @point_count >0 ) or ( position()=1 and $point_count_Pos > 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>
|
|
<bp:Path_Point>
|
|
|
|
|
+ <xsl:copy-of select="@ID_Join"/>
|
|
|
<xsl:attribute name="DebugPosPoint" select="position()"/>
|
|
<xsl:attribute name="DebugPosPoint" select="position()"/>
|
|
|
<xsl:attribute name="PosMatrGroup" select="@PosMatrGroup"/>
|
|
<xsl:attribute name="PosMatrGroup" select="@PosMatrGroup"/>
|
|
|
<xsl:attribute name="distanceGr" select="$distanceGr"/>
|
|
<xsl:attribute name="distanceGr" select="$distanceGr"/>
|
|
@@ -439,6 +444,25 @@
|
|
|
<koniec_wariantow>
|
|
<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 - przeliczony wariant bit=<xsl:value-of select="$best_variant"/> ( nr <xsl:value-of select="$variant"/>;) </xsl:message>
|
|
|
<xsl:attribute name="best_variant" select="$best_variant"/>
|
|
<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: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"></xsl:copy-of>
|
|
|
|
|
+ </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:for-each select="$candidates/bp:Path_Point">
|
|
|
<xsl:sort select="@distance"/>
|
|
<xsl:sort select="@distance"/>
|
|
|
<xsl:if test="substring($best_variant, position(),1)='1'"><!-- jak wystawiony w wariancie-->
|
|
<xsl:if test="substring($best_variant, position(),1)='1'"><!-- jak wystawiony w wariancie-->
|
|
@@ -450,6 +474,22 @@
|
|
|
<xsl:copy-of select="bp:Path_Point"/>
|
|
<xsl:copy-of select="bp:Path_Point"/>
|
|
|
</bp:Path_Point>
|
|
</bp:Path_Point>
|
|
|
</xsl:if>
|
|
</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>
|
|
|
|
|
+ </xsl:if>
|
|
|
</xsl:for-each>
|
|
</xsl:for-each>
|
|
|
</koniec_wariantow>
|
|
</koniec_wariantow>
|
|
|
</xsl:when>
|
|
</xsl:when>
|
|
@@ -470,7 +510,7 @@
|
|
|
<xsl:template name="calc_cost_way"><!-- do wyliczenia ile wyjda kable w takiej konfiguracji -->
|
|
<xsl:template name="calc_cost_way"><!-- do wyliczenia ile wyjda kable w takiej konfiguracji -->
|
|
|
<xsl:param name="cand_to_calc" required="yes"/>
|
|
<xsl:param name="cand_to_calc" required="yes"/>
|
|
|
<xsl:param name="poprzednie_odpalam_liczenie_or_nie"/>
|
|
<xsl:param name="poprzednie_odpalam_liczenie_or_nie"/>
|
|
|
-
|
|
|
|
|
|
|
+ <xsl:param name="show_cables"/><!-- do ostatneigo wyzwolenia w koniec_wariantow aby pokazac skad dokad sa kable-->
|
|
|
<xsl:variable name="candidates_merged_with_poprzednie">
|
|
<xsl:variable name="candidates_merged_with_poprzednie">
|
|
|
<xsl:for-each select="$poprzednie_odpalam_liczenie_or_nie/*">
|
|
<xsl:for-each select="$poprzednie_odpalam_liczenie_or_nie/*">
|
|
|
<bp:Path_Point>
|
|
<bp:Path_Point>
|
|
@@ -503,19 +543,19 @@
|
|
|
</cost>
|
|
</cost>
|
|
|
</xsl:when>
|
|
</xsl:when>
|
|
|
<xsl:when test="@bin_pos=0"><!-- szukamy gdzie ma najblizej i za ile -->
|
|
<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 < current()/@id_path ]/number(@id_path))"/>
|
|
|
|
|
|
|
+ <xsl:variable name="way_up_id" select="max($candidates_merged_with_poprzednie/bp:Path_Point[@bin_pos=1 and @id_path < current()/@id_path ]/number(@ID_Join))"/>
|
|
|
<xsl:variable name="way_up_len" >
|
|
<xsl:variable name="way_up_len" >
|
|
|
<xsl:choose>
|
|
<xsl:choose>
|
|
|
<xsl:when test="$way_up_id">
|
|
<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:otherwise><xsl:value-of select="-1"/></xsl:otherwise>
|
|
|
</xsl:choose>
|
|
</xsl:choose>
|
|
|
</xsl:variable>
|
|
</xsl:variable>
|
|
|
- <xsl:variable name="way_dn_id" select="max($candidates_merged_with_poprzednie/bp:Path_Point[@bin_pos=1 and @id_path > current()/@id_path ]/number(@id_path)) " />
|
|
|
|
|
|
|
+ <xsl:variable name="way_dn_id" select="max($candidates_merged_with_poprzednie/bp:Path_Point[@bin_pos=1 and @id_path > current()/@id_path ]/number(@ID_Join)) " />
|
|
|
<xsl:variable name="way_dn_len">
|
|
<xsl:variable name="way_dn_len">
|
|
|
<xsl:choose>
|
|
<xsl:choose>
|
|
|
<xsl:when test="$way_dn_id">
|
|
<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()/@distance"/>
|
|
|
|
|
|
|
+ <xsl:value-of select=" number($candidates_merged_with_poprzednie/bp:Path_Point[@ID_Join=$way_dn_id]/@distance ) - current()/@distance"/>
|
|
|
</xsl:when>
|
|
</xsl:when>
|
|
|
<xsl:otherwise><xsl:value-of select="-1"/></xsl:otherwise>
|
|
<xsl:otherwise><xsl:value-of select="-1"/></xsl:otherwise>
|
|
|
</xsl:choose>
|
|
</xsl:choose>
|
|
@@ -534,12 +574,18 @@
|
|
|
</xsl:choose>
|
|
</xsl:choose>
|
|
|
</xsl:variable>
|
|
</xsl:variable>
|
|
|
<!-- todo @point_count -->
|
|
<!-- todo @point_count -->
|
|
|
- <xsl:attribute name="PE_Price" select="0"/>
|
|
|
|
|
- <xsl:attribute name="Cable_Price" select="$Cable_Price_sum"/>
|
|
|
|
|
|
|
+ <xsl:if test="$show_cables">
|
|
|
|
|
+ <xsl:attribute name="choosed" select="'down'"/>
|
|
|
|
|
+ <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_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="ID_Join" select="@ID_Join"/>
|
|
|
|
|
+ <xsl:attribute name="Cable_Price" select="$Cable_Price_sum"/>
|
|
|
|
|
+ </xsl:if>
|
|
|
<xsl:attribute name="Price" select="$Cable_Price_sum"/>
|
|
<xsl:attribute name="Price" select="$Cable_Price_sum"/>
|
|
|
- <xsl:attribute name="choosed" select="'down'"/>
|
|
|
|
|
- <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_id" select="$way_dn_id"/><xsl:attribute name="way_dn_len" select="$way_dn_len"/>
|
|
|
|
|
</cost>
|
|
</cost>
|
|
|
</xsl:when>
|
|
</xsl:when>
|
|
|
<xsl:otherwise>
|
|
<xsl:otherwise>
|
|
@@ -554,12 +600,17 @@
|
|
|
</xsl:otherwise>
|
|
</xsl:otherwise>
|
|
|
</xsl:choose>
|
|
</xsl:choose>
|
|
|
</xsl:variable>
|
|
</xsl:variable>
|
|
|
- <xsl:attribute name="Cable_Price" select="$Cable_Price_sum"/> <!-- todo @point_count -->
|
|
|
|
|
- <xsl:attribute name="PE_Price" select="0"/>
|
|
|
|
|
|
|
+ <xsl:if test="$show_cables">
|
|
|
|
|
+ <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="ID_Join" select="@ID_Join"/>
|
|
|
|
|
+ </xsl:if>
|
|
|
<xsl:attribute name="Price" select="$Cable_Price_sum"/>
|
|
<xsl:attribute name="Price" select="$Cable_Price_sum"/>
|
|
|
- <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_id" select="$way_dn_id"/><xsl:attribute name="way_dn_len" select="$way_dn_len"/>
|
|
|
|
|
</cost>
|
|
</cost>
|
|
|
</xsl:otherwise>
|
|
</xsl:otherwise>
|
|
|
</xsl:choose>
|
|
</xsl:choose>
|