|
|
@@ -142,90 +142,89 @@
|
|
|
|
|
|
|
|
|
<!-- rozmieszczamy prawidlowo PE na danej trasie -->
|
|
|
- <xsl:variable name="EconomicDistanceCut">
|
|
|
- <EconomicDistanceCut>
|
|
|
- <xsl:for-each select="$edge_joins_filled_path/edge_joins_filled_paths_xml/asText_XMl/LineString[not(@error)]">
|
|
|
- <distance>
|
|
|
- <xsl:attribute name="pos" select="position()"/>
|
|
|
- <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="id_path" select="@id_path"/>
|
|
|
- <xsl:variable name="Points" select="count(Points)"/>
|
|
|
- <xsl:attribute name="Points" select="$Points"/>
|
|
|
- <xsl:variable name="Ways" select="count(Ways)"/>
|
|
|
- <xsl:attribute name="Ways_count" select="$Ways"/>
|
|
|
- <xsl:choose>
|
|
|
- <xsl:when test="$Ways or $Points">
|
|
|
- <xsl:attribute name="point_count" select="$Points + $Ways"/>
|
|
|
- <!--<xsl:attribute name="NotPoints" select="0"/>--><!-- do Grupowanai potrzebne aby nie liczyc tych w count -->
|
|
|
- <xsl:if test="Ways">
|
|
|
- <!-- sprawdzamy jak sie dowiazuje i ile ma do najblizszego wezla -->
|
|
|
- <xsl:for-each-group select="Ways" group-by="@ID_WAY">
|
|
|
- <PathsCrossed>
|
|
|
- <xsl:attribute name="ID_WAY" select="@ID_WAY"/><xsl:attribute name="debug" select="'created at #163 by parsing Ways'"/>
|
|
|
- <xsl:variable name="Joining_ID_Join_from" select="parent::node()/@ID_Join"/>
|
|
|
- <xsl:choose>
|
|
|
- <xsl:when test="$PathsCrossed/PathsCrossed/Ways[@ID_WAY= current()/@ID_WAY]/(bp:Path_Point)[@ID_Join= $Joining_ID_Join_from]/@pos">
|
|
|
- <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="Deb_Cur_ID_WAY" select="@ID_WAY"/>
|
|
|
- <xsl:attribute name="Joining_ID_Join_from" select="$Joining_ID_Join_from"/>
|
|
|
-
|
|
|
- <!-- chk w gore -->
|
|
|
- <xsl:variable name="NeighJoin_way_up_pos" select="max($PathsCrossed/PathsCrossed/Ways[@ID_WAY= current()/@ID_WAY]/(bp:Path_Point)[ number(@pos) < number($NeighJoin_pos) ] /@pos)"/>
|
|
|
- <xsl:choose>
|
|
|
- <xsl:when test="$NeighJoin_way_up_pos">
|
|
|
- <xsl:attribute name="NeighJoin_way_up_pos" select="$NeighJoin_way_up_pos"/>
|
|
|
- <xsl:variable name="NeighJoin_way_up_ID_Join" select="$PathsCrossed/PathsCrossed/Ways[@ID_WAY= current()/@ID_WAY]/(bp:Path_Point)[ @pos=$NeighJoin_way_up_pos] /@ID_Join" />
|
|
|
- <xsl:variable name="NeighJoin_way_up_len" select="number($NeighJoin_pos_distance) - number($PathsCrossed/PathsCrossed/Ways[@ID_WAY= current()/@ID_WAY]/(bp:Path_Point)[ @pos=$NeighJoin_way_up_pos] /@distance) "/>
|
|
|
- <xsl:attribute name="NeighJoin_way_up_len" select="$NeighJoin_way_up_len"/>
|
|
|
- <xsl:attribute name="NeighJoin_way_up_pos" select="$NeighJoin_way_up_pos"/>
|
|
|
- <xsl:attribute name="NeighJoin_way_up_ID_Join" select="$NeighJoin_way_up_ID_Join"/>
|
|
|
- </xsl:when>
|
|
|
- <xsl:otherwise>
|
|
|
- <xsl:attribute name="NeighJoin_way_up_len" select="-1"/>
|
|
|
- </xsl:otherwise>
|
|
|
- </xsl:choose>
|
|
|
- <xsl:variable name="NeighJoin_way_dn_pos" select="min($PathsCrossed/PathsCrossed/Ways[@ID_WAY= current()/@ID_WAY]/(bp:Path_Point)[ number(@pos) > number($NeighJoin_pos) ] /@pos)"/>
|
|
|
- <xsl:choose>
|
|
|
- <xsl:when test="$NeighJoin_way_dn_pos">
|
|
|
- <xsl:variable name="NeighJoin_way_dn_ID_Join" select="$PathsCrossed/PathsCrossed/Ways[@ID_WAY= current()/@ID_WAY]/(bp:Path_Point)[ @pos=$NeighJoin_way_dn_pos] /@ID_Join"/>
|
|
|
- <xsl:variable name="NeighJoin_way_dn_len" select="number($PathsCrossed/PathsCrossed/Ways[@ID_WAY= current()/@ID_WAY]/(bp:Path_Point)[ @pos=$NeighJoin_way_dn_pos] /@distance) - number($NeighJoin_pos_distance) "/>
|
|
|
- <xsl:attribute name="NeighJoin_way_dn_pos" select="$NeighJoin_way_dn_pos"/>
|
|
|
- <xsl:attribute name="NeighJoin_way_dn_ID_Join" select="$NeighJoin_way_dn_ID_Join"/>
|
|
|
- <xsl:attribute name="NeighJoin_way_dn_len" select="$NeighJoin_way_dn_len"/>
|
|
|
- </xsl:when>
|
|
|
- <xsl:otherwise>
|
|
|
- <xsl:attribute name="NeighJoin_way_dn_len" select="-1"/>
|
|
|
- </xsl:otherwise>
|
|
|
- </xsl:choose>
|
|
|
- <!-- chk w dol -->
|
|
|
- <xsl:if test=" number($debug) > 3">
|
|
|
- <debug186>
|
|
|
- <xsl:copy-of select="$PathsCrossed/PathsCrossed/Ways[@ID_WAY= current()/@ID_WAY]"/>
|
|
|
- </debug186>
|
|
|
- </xsl:if>
|
|
|
- </xsl:when>
|
|
|
- <xsl:otherwise>
|
|
|
- <xsl:comment>No connection to other roads found</xsl:comment>
|
|
|
- </xsl:otherwise>
|
|
|
- </xsl:choose>
|
|
|
- </PathsCrossed>
|
|
|
- </xsl:for-each-group>
|
|
|
- </xsl:if>
|
|
|
- </xsl:when>
|
|
|
- <xsl:otherwise><xsl:attribute name="NotPoints" select="1"/>
|
|
|
- <xsl:attribute name="point_count" select="0"/>
|
|
|
- </xsl:otherwise><!-- do Grupowanai potrzebne aby nie liczyc tych w count -->
|
|
|
- </xsl:choose>
|
|
|
-
|
|
|
- </distance>
|
|
|
- </xsl:for-each>
|
|
|
- </EconomicDistanceCut>
|
|
|
- </xsl:variable>
|
|
|
+ <xsl:variable name="EconomicDistanceCut">
|
|
|
+ <EconomicDistanceCut>
|
|
|
+ <xsl:for-each select="$edge_joins_filled_path/edge_joins_filled_paths_xml/asText_XMl/LineString[not(@error)]">
|
|
|
+ <distance>
|
|
|
+ <xsl:attribute name="pos" select="position()"/>
|
|
|
+ <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="id_path" select="@id_path"/>
|
|
|
+ <xsl:variable name="Points" select="count(Points)"/>
|
|
|
+ <xsl:attribute name="Points" select="$Points"/>
|
|
|
+ <xsl:variable name="Ways" select="count(Ways)"/>
|
|
|
+ <xsl:attribute name="Ways_count" select="$Ways"/>
|
|
|
+ <xsl:choose>
|
|
|
+ <xsl:when test="$Ways or $Points">
|
|
|
+ <xsl:attribute name="point_count" select="$Points + $Ways"/>
|
|
|
+ <!--<xsl:attribute name="NotPoints" select="0"/>--><!-- do Grupowanai potrzebne aby nie liczyc tych w count -->
|
|
|
+ <xsl:if test="Ways">
|
|
|
+ <!-- sprawdzamy jak sie dowiazuje i ile ma do najblizszego wezla -->
|
|
|
+ <xsl:for-each-group select="Ways" group-by="@ID_WAY">
|
|
|
+ <PathsCrossed>
|
|
|
+ <xsl:attribute name="ID_WAY" select="@ID_WAY"/><xsl:attribute name="debug" select="'created at #163 by parsing Ways'"/>
|
|
|
+ <xsl:variable name="Joining_ID_Join_from" select="parent::node()/@ID_Join"/>
|
|
|
+ <xsl:choose>
|
|
|
+ <xsl:when test="$PathsCrossed/PathsCrossed/Ways[@ID_WAY= current()/@ID_WAY]/(bp:Path_Point)[@ID_Join= $Joining_ID_Join_from]/@pos">
|
|
|
+ <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="Deb_Cur_ID_WAY" select="@ID_WAY"/>
|
|
|
+ <xsl:attribute name="Joining_ID_Join_from" select="$Joining_ID_Join_from"/>
|
|
|
+
|
|
|
+ <!-- chk w gore -->
|
|
|
+ <xsl:variable name="NeighJoin_way_up_pos" select="max($PathsCrossed/PathsCrossed/Ways[@ID_WAY= current()/@ID_WAY]/(bp:Path_Point)[ number(@pos) < number($NeighJoin_pos) ] /@pos)"/>
|
|
|
+ <xsl:choose>
|
|
|
+ <xsl:when test="$NeighJoin_way_up_pos">
|
|
|
+ <xsl:attribute name="NeighJoin_way_up_pos" select="$NeighJoin_way_up_pos"/>
|
|
|
+ <xsl:variable name="NeighJoin_way_up_ID_Join" select="$PathsCrossed/PathsCrossed/Ways[@ID_WAY= current()/@ID_WAY]/(bp:Path_Point)[ @pos=$NeighJoin_way_up_pos] /@ID_Join" />
|
|
|
+ <xsl:variable name="NeighJoin_way_up_len" select="number($NeighJoin_pos_distance) - number($PathsCrossed/PathsCrossed/Ways[@ID_WAY= current()/@ID_WAY]/(bp:Path_Point)[ @pos=$NeighJoin_way_up_pos] /@distance) "/>
|
|
|
+ <xsl:attribute name="NeighJoin_way_up_len" select="$NeighJoin_way_up_len"/>
|
|
|
+ <xsl:attribute name="NeighJoin_way_up_pos" select="$NeighJoin_way_up_pos"/>
|
|
|
+ <xsl:attribute name="NeighJoin_way_up_ID_Join" select="$NeighJoin_way_up_ID_Join"/>
|
|
|
+ </xsl:when>
|
|
|
+ <xsl:otherwise>
|
|
|
+ <xsl:attribute name="NeighJoin_way_up_len" select="-1"/>
|
|
|
+ </xsl:otherwise>
|
|
|
+ </xsl:choose>
|
|
|
+ <xsl:variable name="NeighJoin_way_dn_pos" select="min($PathsCrossed/PathsCrossed/Ways[@ID_WAY= current()/@ID_WAY]/(bp:Path_Point)[ number(@pos) > number($NeighJoin_pos) ] /@pos)"/>
|
|
|
+ <xsl:choose>
|
|
|
+ <xsl:when test="$NeighJoin_way_dn_pos">
|
|
|
+ <xsl:variable name="NeighJoin_way_dn_ID_Join" select="$PathsCrossed/PathsCrossed/Ways[@ID_WAY= current()/@ID_WAY]/(bp:Path_Point)[ @pos=$NeighJoin_way_dn_pos] /@ID_Join"/>
|
|
|
+ <xsl:variable name="NeighJoin_way_dn_len" select="number($PathsCrossed/PathsCrossed/Ways[@ID_WAY= current()/@ID_WAY]/(bp:Path_Point)[ @pos=$NeighJoin_way_dn_pos] /@distance) - number($NeighJoin_pos_distance) "/>
|
|
|
+ <xsl:attribute name="NeighJoin_way_dn_pos" select="$NeighJoin_way_dn_pos"/>
|
|
|
+ <xsl:attribute name="NeighJoin_way_dn_ID_Join" select="$NeighJoin_way_dn_ID_Join"/>
|
|
|
+ <xsl:attribute name="NeighJoin_way_dn_len" select="$NeighJoin_way_dn_len"/>
|
|
|
+ </xsl:when>
|
|
|
+ <xsl:otherwise>
|
|
|
+ <xsl:attribute name="NeighJoin_way_dn_len" select="-1"/>
|
|
|
+ </xsl:otherwise>
|
|
|
+ </xsl:choose>
|
|
|
+ <!-- chk w dol -->
|
|
|
+ <xsl:if test=" number($debug) > 3">
|
|
|
+ <debug186>
|
|
|
+ <xsl:copy-of select="$PathsCrossed/PathsCrossed/Ways[@ID_WAY= current()/@ID_WAY]"/>
|
|
|
+ </debug186>
|
|
|
+ </xsl:if>
|
|
|
+ </xsl:when>
|
|
|
+ <xsl:otherwise>
|
|
|
+ <xsl:comment>No connection to other roads found</xsl:comment>
|
|
|
+ </xsl:otherwise>
|
|
|
+ </xsl:choose>
|
|
|
+ </PathsCrossed>
|
|
|
+ </xsl:for-each-group>
|
|
|
+ </xsl:if>
|
|
|
+ </xsl:when>
|
|
|
+ <xsl:otherwise><xsl:attribute name="NotPoints" select="1"/>
|
|
|
+ <xsl:attribute name="point_count" select="0"/>
|
|
|
+ </xsl:otherwise><!-- do Grupowanai potrzebne aby nie liczyc tych w count -->
|
|
|
+ </xsl:choose>
|
|
|
+ </distance>
|
|
|
+ </xsl:for-each>
|
|
|
+ </EconomicDistanceCut>
|
|
|
+ </xsl:variable>
|
|
|
<xsl:if test="$debug">
|
|
|
<debug_174>
|
|
|
<xsl:copy-of select="$EconomicDistanceCut"/>
|
|
|
@@ -284,6 +283,35 @@
|
|
|
<debug_Cut2_183>
|
|
|
<xsl:copy-of select="$EconomicDistanceCut2"/>
|
|
|
</debug_Cut2_183>
|
|
|
+ <!-- narzucenie max ilosci grup oraz wyliczenie ile jest -->
|
|
|
+ <!--<xsl:variable name="$max_combinate_groups_elements"/>-->
|
|
|
+
|
|
|
+ <xsl:variable name="max_combinate_groups_elements_for_group">
|
|
|
+ <xsl:variable name="elements_cnt" select="count($EconomicDistanceCut2/EconomicDistanceCut2/distance2[number(@point_count) > number(0) ])"/>
|
|
|
+ <xsl:variable name="cost_dist_Cnt" select="count($EconomicDistanceCut2/EconomicDistanceCut2/distance2[ ( number(@cost_dist) > number($PE_Price) ) or number(@len) > ( number($PE_Price) div number($Cable_Price) ) ])"/>
|
|
|
+ <xsl:variable name="bit_max" select="round($len div ( $PE_Price div $Cable_Price ) + $cost_dist_Cnt ) + 1"/>
|
|
|
+
|
|
|
+ <xsl:choose>
|
|
|
+ <xsl:when test="number($bit_max) < number(15) "> <!-- do przyjecia przez procesor kombinacji-->
|
|
|
+ <xsl:message>#296 max_combinate_groups_elements_for_group number($bit_max=<xsl:value-of select="$bit_max"/>) < number(15)</xsl:message>
|
|
|
+ <xsl:choose>
|
|
|
+ <xsl:when test="number($elements_cnt) > 50">
|
|
|
+ <xsl:message>#297 narzucam fixed liczbe 40 z uwagi na $bit_max=<xsl:value-of select="$bit_max"/> < 15 ilosc max = $elements_cnt=<xsl:value-of select="$elements_cnt"/>; </xsl:message>
|
|
|
+ <xsl:value-of select="40"/>
|
|
|
+ </xsl:when>
|
|
|
+ <xsl:otherwise>
|
|
|
+ <xsl:message>#302 max_combinate_groups_elements_for_group setting to current count - number($elements_cnt=<xsl:value-of select="$elements_cnt"/>); </xsl:message>
|
|
|
+ <xsl:value-of select="number($elements_cnt)"/>
|
|
|
+ </xsl:otherwise>
|
|
|
+ </xsl:choose>
|
|
|
+ </xsl:when>
|
|
|
+ <xsl:otherwise>
|
|
|
+ <xsl:message>#309 max_combinate_groups_elements_for_group otherwise setting to default $max_combinate_groups_elements=<xsl:value-of select="$max_combinate_groups_elements"/>; </xsl:message>
|
|
|
+ <xsl:value-of select="$max_combinate_groups_elements"/>
|
|
|
+ </xsl:otherwise>
|
|
|
+ </xsl:choose>
|
|
|
+ </xsl:variable>
|
|
|
+
|
|
|
|
|
|
<xsl:variable name="EconomicDistanceCut2">
|
|
|
<EconomicDistanceCut2><xsl:attribute name="debug" select="'bez pustych punktow tylko grupowanie'"/>
|
|
|
@@ -291,7 +319,7 @@
|
|
|
<distance2>
|
|
|
<xsl:copy-of select="@*"/>
|
|
|
<xsl:choose>
|
|
|
- <xsl:when test=" position() mod $max_combinate_groups_elements = 0"> <!--- minus puste sum($EconomicDistanceCut/EconomicDistanceCut/distance[ number(@pos) < number(current()/@pos) ]/number(@NotPoints)) ) --><!-- nabija grupe do przeliczenia-->
|
|
|
+ <xsl:when test=" position() mod $max_combinate_groups_elements_for_group = 0"> <!--- minus puste sum($EconomicDistanceCut/EconomicDistanceCut/distance[ number(@pos) < number(current()/@pos) ]/number(@NotPoints)) ) --><!-- nabija grupe do przeliczenia-->
|
|
|
<xsl:attribute name="PosCut3Flag" select="1"/>
|
|
|
</xsl:when>
|
|
|
<xsl:otherwise>
|
|
|
@@ -334,9 +362,11 @@
|
|
|
<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="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="elements_cnt" select="count($EconomicDistanceCut2/EconomicDistanceCut2/distance2[number(@point_count) > number(0) ])"/><!-- liczba wezlow potencjalnych licbza PE-->
|
|
|
+ <xsl:variable name="cost_dist_Cnt" select="count($EconomicDistanceCut2/EconomicDistanceCut2/distance2[ ( number(@cost_dist) > number($PE_Price) ) or number(@len) > ( number($PE_Price) div number($Cable_Price) ) ])"/>
|
|
|
+ <xsl:variable name="bit_max" select="round($len div ( $PE_Price div $Cable_Price ) + $cost_dist_Cnt )"/>
|
|
|
+ <!-- max licbza PE-->
|
|
|
+ <xsl:message>#341Calc $cost_dist_Cnt=<xsl:value-of select="$cost_dist_Cnt"/>; $elements_cnt=<xsl:value-of select="$elements_cnt"/>; $bit_max=<xsl:value-of select="$bit_max"/> ; </xsl:message>
|
|
|
|
|
|
|
|
|
<!-- pogrupujemy elementy co 50 metrow lub grupy ilosciowe -->
|
|
|
@@ -346,7 +376,7 @@
|
|
|
<PointMatrixGroupPos>
|
|
|
<xsl:variable name="elements_cnt_Pos" select="count(current-group()[@point_count > 0])"/>
|
|
|
<xsl:variable name="countGr" select="count(current-group())"/>
|
|
|
- <xsl:variable name="bit_max_Pos" select="round(sum( current-group()/@disttopkt ) div ( $PE_Price div 20 ) )"/>
|
|
|
+ <xsl:variable name="bit_max_Pos" select="round(sum( current-group()/number(@disttopkt) ) div ( number($PE_Price) div number($Cable_Price) ) )"/>
|
|
|
<xsl:message>Nowa grupa Ways:<xsl:value-of select="@PosCut3GrId"/>; distanceGr=<xsl:value-of select="@PosCut3GrId"/>;elements_cnt_Pos=<xsl:value-of select="$elements_cnt_Pos"/>; @bit_max_Pos=<xsl:value-of select="$bit_max_Pos"/>; @id_path=<xsl:value-of select="@id_path"/>; countGr=<xsl:value-of select="$countGr"/>; point_count_Pos=<xsl:value-of select="sum(current-group()/@point_count)"/>; len_sum=<xsl:value-of select="sum(current-group()/@len)"/> ; distanceBeg/distanceEnd= <xsl:value-of select="min(current-group()/number(@distance))"/>/<xsl:value-of select="max(current-group()/number(@distance))"/>
|
|
|
</xsl:message>
|
|
|
<xsl:attribute name="distanceGr" select="@PosCut3GrId "/> <!-- bylo current-grouping-key() -->
|
|
|
@@ -441,9 +471,7 @@
|
|
|
<xsl:variable name="odpalam_liczenie_or_nie">
|
|
|
<xsl:choose>
|
|
|
<xsl:when test="1=1"> <!-- bylo count($candidates/bp:Path_Point) <= $max_combinate_groups_elements and count($candidates/bp:Path_Point)>1-->
|
|
|
- <xsl:variable name="max_bit">
|
|
|
- <xsl:for-each select="1 to count($candidates/bp:Path_Point)"><xsl:value-of select="1"/></xsl:for-each>
|
|
|
- </xsl:variable>
|
|
|
+
|
|
|
<odpalam_liczenie>
|
|
|
<!-- todo dolozyc poprzedni wezel dodany aby mogl od niego zawsze liczyc -->
|
|
|
<!--<disabled>temporary blad after #410 OK - przeliczony wariant bit=000000010000 ( nr 4095;)
|
|
|
@@ -461,11 +489,15 @@
|
|
|
<xsl:otherwise><xsl:value-of select="1"/></xsl:otherwise>
|
|
|
</xsl:choose>
|
|
|
</xsl:variable>
|
|
|
-
|
|
|
+ <xsl:variable name="max_possible_bit"><!-- produkuje 11111111 -->
|
|
|
+ <xsl:for-each select="1 to count($candidates/bp:Path_Point)"><xsl:value-of select="1"/></xsl:for-each>
|
|
|
+ </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="max_bit" select="$bit_max_Pos"/>
|
|
|
+ <xsl:with-param name="max_possible_bit" select="$max_possible_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>
|
|
|
@@ -549,10 +581,30 @@
|
|
|
<xsl:param name="elements_cnt" required="yes"/>
|
|
|
<xsl:param name="variant" select="1"/>
|
|
|
<xsl:param name="max_bit" required="yes"/>
|
|
|
+ <xsl:param name="max_possible_bit" required="yes"/>
|
|
|
<xsl:param name="best_cost"/><xsl:param name="best_variant"/>
|
|
|
<xsl:param name="poprzednie_odpalam_liczenie_or_nie"/>
|
|
|
<!-- do jednorazowego wyzwolenia przez fukcje, aby tylko raz odjelo wariant zerowy -->
|
|
|
|
|
|
+ <!-- znajduje kolejny korzystny wariant bit -->
|
|
|
+ <xsl:variable name="variant">
|
|
|
+ <xsl:choose>
|
|
|
+ <xsl:when test="number($max_bit) >= number($elements_cnt)">
|
|
|
+ <xsl:message>#576 $max_bit <xsl:value-of select="$max_bit"/> >$elements_cnt=<xsl:value-of select="$elements_cnt"/>; in $variant=<xsl:value-of select="$variant"/>;</xsl:message>
|
|
|
+ <xsl:value-of select="$variant"/>
|
|
|
+ </xsl:when>
|
|
|
+ <xsl:when test="number($max_bit) > 0">
|
|
|
+
|
|
|
+ <xsl:message>#80 try to find next $max_bit <xsl:value-of select="$max_bit"/> >$elements_cnt=<xsl:value-of select="$elements_cnt"/>; in $variant=<xsl:value-of select="$variant"/>;</xsl:message>
|
|
|
+ <xsl:variable name="variant_found" select="bp:next_bit_max($variant,$max_bit,$elements_cnt,0)"/>
|
|
|
+ <xsl:value-of select="$variant_found"/>
|
|
|
+ <xsl:message>... $variant_found <xsl:value-of select="$variant_found"/>;</xsl:message>
|
|
|
+ </xsl:when>
|
|
|
+ <xsl:otherwise>
|
|
|
+ <xsl:value-of select="$variant"/>
|
|
|
+ </xsl:otherwise>
|
|
|
+ </xsl:choose>
|
|
|
+ </xsl:variable>
|
|
|
|
|
|
<xsl:variable name="bit" select=" string-join(bp:decimalToBitFill($variant,$elements_cnt),'')"/>
|
|
|
|
|
|
@@ -614,7 +666,7 @@
|
|
|
<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">
|
|
|
+ <xsl:when test="$bit = $max_possible_bit">
|
|
|
<koniec_wariantow>
|
|
|
<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"/>
|
|
|
@@ -672,6 +724,7 @@
|
|
|
<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="max_possible_bit" select="$max_possible_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"/>
|