Author Topic: Multiple resistor dividers BOM optimisation  (Read 4605 times)

0 Members and 1 Guest are viewing this topic.

Offline bobofTopic starter

  • Contributor
  • Posts: 36
  • Country: gb
Re: Multiple resistor dividers BOM optimisation
« Reply #25 on: July 24, 2021, 07:09:14 am »
If you just want to remove the number of different BOM items, you could replace other less critical resistors with the same ones used in your dividers.

Eg: replace all the random 10k pull-ups with a 12.4k required for a divider somewhere.
Thanks, yes, it's on my list to do too, though in this case there ended up being hardly any, as if I recall correctly the 10K and the 47K values ended up getting used by the algorithm in dividers! :). Though I think it's worth bearing in mind, as it could result in closer dividers to the required values.

Sounds like the kind of thing where if you were making a fully featured program to do it, specifying which existing resistors were non-critical with a +/- tolerance for their value would be a way to go, as it could then crunch all the permutations for you.
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8110
  • Country: fi
Re: Multiple resistor dividers BOM optimisation
« Reply #26 on: July 24, 2021, 03:46:08 pm »
Brute force shouldn't waste memory, only processing time, I have used it for similar problems. Code doesn't need to look nice or be particularly modular; you know the scope and want to solve it for yourself.

Score each solution, keep track of the best solution so far, and its score. Wastes no memory, only processing power. Even tracking like 16 best solutions as a binary max heap or min heap is low-cost and wastes little CPU or memory, that is, sometimes you want to see a few more results than just the "best", for doing manual choices.

Outer loop can fork bunch of threads which works fine because the problem is CPU heavy and amount of constant input data is very modest likely fitting the per-core L1 caches. Put any parameter with larger dataset in the outer loops.

Consider writing in C or C++ instead of Python for higher performance, nested for loops work fine.

But of course, at some point brute force stops being acceptable, but then you need to understand much more complex problem solving algorithms.
« Last Edit: July 24, 2021, 03:51:01 pm by Siwastaja »
 

Offline bobofTopic starter

  • Contributor
  • Posts: 36
  • Country: gb
Re: Multiple resistor dividers BOM optimisation
« Reply #27 on: July 24, 2021, 06:04:46 pm »
Brute force shouldn't waste memory, only processing time, I have used it for similar problems. Code doesn't need to look nice or be particularly modular; you know the scope and want to solve it for yourself.
Do not underestimate just how lazy I was feeling! :)  Python has some functions which I used to just multiply all the tables of possible values and then walked that...  I only "program" (hack really) occasionally these days and it was the limit of what I had the energy for.  I should at least fix that as it would solve the memory usage...
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf