OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Python Optimize minimum unique elements that fit within ranges (Intervalltree?)

  • Thread starter Thread starter Stephan Ketterer
  • Start date Start date
S

Stephan Ketterer

Guest
I have a table with row elements that have a minimum and a maximum height and width, and I am trying to find a way to calculate the minimum number of sizes that I need to to satisfy all the conditions of being between the min and the max. I tried to use ChatGPT and it offered me a solution using Intervalltree, but it does not seem to work and the documentation on it seems sparse:

The first few rows of the table looks like this:

WidthHeightWidthmaxWidthminHeightmaxHeightmin
46.62588.045.87545.12587.2586.5
47.2587.7546.545.7587.086.25
46.7572.546.045.2571.7571.0
45.587.37544.7544.086.62585.875
45.37587.37544.62543.87586.62585.875
45.37595.37544.62543.87594.62593.875
45.62595.37544.87544.12594.62593.875
<p>I have a table with row elements that have a minimum and a maximum height and width, and I am trying to find a way to calculate the minimum number of sizes that I need to to satisfy all the conditions of being between the min and the max. I tried to use ChatGPT and it offered me a solution using Intervalltree, but it does not seem to work and the documentation on it seems sparse:</p>
<p>The first few rows of the table looks like this:</p>
<div class="s-table-container"><table class="s-table">
<thead>
<tr>
<th>Width</th>
<th>Height</th>
<th>Widthmax</th>
<th>Widthmin</th>
<th>Heightmax</th>
<th>Heightmin</th>
</tr>
</thead>
<tbody>
<tr>
<td>46.625</td>
<td>88.0</td>
<td>45.875</td>
<td>45.125</td>
<td>87.25</td>
<td>86.5</td>
</tr>
<tr>
<td>47.25</td>
<td>87.75</td>
<td>46.5</td>
<td>45.75</td>
<td>87.0</td>
<td>86.25</td>
</tr>
<tr>
<td>46.75</td>
<td>72.5</td>
<td>46.0</td>
<td>45.25</td>
<td>71.75</td>
<td>71.0</td>
</tr>
<tr>
<td>45.5</td>
<td>87.375</td>
<td>44.75</td>
<td>44.0</td>
<td>86.625</td>
<td>85.875</td>
</tr>
<tr>
<td>45.375</td>
<td>87.375</td>
<td>44.625</td>
<td>43.875</td>
<td>86.625</td>
<td>85.875</td>
</tr>
<tr>
<td>45.375</td>
<td>95.375</td>
<td>44.625</td>
<td>43.875</td>
<td>94.625</td>
<td>93.875</td>
</tr>
<tr>
<td>45.625</td>
<td>95.375</td>
<td>44.875</td>
<td>44.125</td>
<td>94.625</td>
<td>93.875</td>
</tr>
</tbody>
</table></div>
 

Latest posts

I
Replies
0
Views
1
Isaac P. Liu
I
U
Replies
0
Views
1
user3658366
U
G
Replies
0
Views
1
Giampaolo Levorato
G
M
Replies
0
Views
1
Marcelo Rodrigo Nascimento
M
Top