Python Forum
Need an alternative to brute force optimization loop
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need an alternative to brute force optimization loop
#1
Hello,
I have a function with 3 intricated loops to get the best parameters from about 16000000 combinations. This takes a lot of time.
I am looking for an alternative.
Here is the function.

            for a in range(700, 800, 1):
                a = a / 100
                for c in range(100, 200, 1):
                    #c = c / 10.0
                    for seed in range(min_seed, max_seed + 1):
                        #seed = seed/20.0
                        generated_sequence = generate_sequence(a, c, best_m, seed, len(adjusted_values))
                        cubed_difference = calculate_mean_squared_error(generated_sequence, adjusted_values)

                        if cubed_difference < min_cubed_difference:
                            min_cubed_difference = cubed_difference
                            best_a = a
                            best_c = c
                            best_seed = seed
buran write Nov-30-2023, 07:57 AM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Reply


Messages In This Thread
Need an alternative to brute force optimization loop - by jmbonni - Nov-29-2023, 11:32 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Brute Forcing Anagrams Anorak 13 2,974 May-05-2025, 04:12 PM
Last Post: MeganWillia
  Solving an equation by brute force within a range alexfrol86 3 4,414 Aug-09-2022, 09:44 AM
Last Post: Gribouillis
  force a program to exit ? Armandito 3 5,257 May-12-2022, 04:03 PM
Last Post: Gribouillis
  How to use scipy.optimization.brute for multivariable function Shiladitya 9 9,312 Oct-28-2020, 10:40 PM
Last Post: scidam
  best way to force an exception Skaperen 2 2,929 Oct-21-2020, 05:59 AM
Last Post: Gribouillis
  I need advise with developing a brute forcing script fatjuicypython 11 8,952 Aug-21-2020, 09:20 PM
Last Post: Marbelous
  Force calculation result as decimal vercetty92 4 3,997 Mar-20-2019, 02:27 PM
Last Post: vercetty92
  Password Brute Force 2skywalkers 9 7,777 Oct-18-2018, 02:35 PM
Last Post: buran
  Brute Force Password Guesser 2skywalkers 1 4,046 Oct-05-2018, 08:04 PM
Last Post: ichabod801
  Brute Force Pad Lock Guesser RedSkeleton007 4 5,525 Mar-03-2018, 07:42 AM
Last Post: RedSkeleton007

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020