# Use number slider to manager a preset range

Generative Design / Refinery will play with my Number Sliders to try different variations. So how do I reuse the slider for variations of input values?

Example:

I have a spreadsheet with a list of rooms with a max side length and a minimum side length.

So how can I reuse the slider on each range so that the lowest number I get via the slider is the min side length and the max is the max side length.

Getting the max is easy since it’s just the max * 1. But how do I make the minimum value on the slider result in the minimum value of my range (which would normally be min * 1)?

Hello…could you show your graph… what you had tried so far ??

It almost works now, but can’t quite reach the edge numbers because of multiplication by zero issues. My slider starts at 0.01 to avoid this, which creates other problems.

So is this an elegant solution or is there a better way?
Generative design simple layout data collection.dyn (34.8 KB)

Perhaps test if the side is less than the minimum value, and of so use that instead of the area.

Be warned though: that will have Generative Design sampling the same value (for minimum distance) repeatedly which can slow the exploration phase when using optimize as the output.

Personally I prefer to use the dimensions “as is” and find the closest area in your dictionary, and then have a ‘standardization score’ output which would tell you how far outside of the dictionary values the design falls. Then penalize that value severely (ie: if you are trying to have a lowest possible score, add 10,000) to cause the algorithm to avoid those values.

2 Likes

You can also normalize your range by using the slider as a percentage of your allowable values.

In this case, slider value n (0.00-1.00) represents the difference in your max and min. So your formula would be `min + n(max-min)`.

4 Likes

Thanks for the help @jacob.small
That’s a much better solution, thanks @Nick_Boyts and solution my tutor has been trying to explain to me. Guess I need to go back and do high school math!

I’ll keep that in mind. I’m not that far in learning to use GD yet.