Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9191805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:46:29+00:00 2026-06-17T20:46:29+00:00

In my program i have a loop which computes integer values and put it

  • 0

In my program i have a loop which computes integer values and put it one after another into an arraylist.
The higher the computetd integer value is, the better it is.
Now i want to continue to compute until it seems to be that there will not come any better integer value. That is, when the computed integer decreases over a range, or it does not change anymore. I’m thinking of, comparing the current computed value with the last x (how much value do i have to concern?) If it is always smaller or equals than any of the last x elements I stop computing. But with this strategy i have no guarantee that this is the global maximum, but just a local….

What is a good strategy to do that?

EDIT:
I know that there can’t be a guarantee to find the global maximum.
But i know a little about the behaviour of the function:
The more values i have already computed the more unlikely it is that the global maximum will appear.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:46:30+00:00Added an answer on June 17, 2026 at 8:46 pm

    Well, it seems that you need to assume some heuristics to assess when to stop. Since you cannot say “I stop now, as I found my max”, you can proceed in one of the following fashions:

    • Keep current maximum and compare the next value with the current one, if it is smaller, increase the counter. If the counter reaches X (your parameter) you stop
    • Use a probablity distributionfunction which has probability of 1 at 0, and 0 at +inf. this can be tailored to your liking. Then, you simply increment the number of seen values, or a counter of smaller values, and using that counter you estimate the probability using that function. If prob < X (your param again) you stop.

    Hope this gives you some idea

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a Linux program that runs in a while(true) loop, which waits
Hi I have a program to use one macro to call another one. I
In my program I have a while loop which iterates through an array list
I'm writing a small sockets program (GNU libc). I have a loop which asks
I am trying to write a OpenMp program. I have a for loop which
I have a program in Octave that has a loop - running a function
As you can see below, I have Parallel.For loop. If run the program while
I have a following code in a most inner loop of my program struct
I'm writing a basic war-driving program. I have gotten it to loop the command
In my main thread I have a while(listening) loop which calls accept() on my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.