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 8580273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:47:36+00:00 2026-06-11T20:47:36+00:00

Having a problem with this Error. I am creating a GA and the loop

  • 0

Having a problem with this Error. I am creating a GA and the loop is to assign my fitness value to an array.

some of the variables

Dim Chromolength as integer
Chromolength = varchromolength * aVariables 
Dim i as integer, j as integer, counter as integer
Dim Poparr() As Integer
Dim FitValarr() As Integer

the code:

ReDim Poparr(1 To PopSize, 1 To Chromolength)

For i = 1 To PopSize                
  For j = 1 To Chromolength       
    If Rnd < 0.5 Then           
        Poparr(i, j) = 0
    Else
        Poparr(i, j) = 1        
    End If
  Next j
Next i

For i = 1 To PopSize                   
 j = 1                           
 counter = Chromolength              
 Do While counter > 0  
   FitValarr(i) = FitValarr(i) + Poparr(i, counter) * 2 ^ (j - 1)          
  j = j + 1                   
  counter = counter - 1       
 Loop
Next i      

I am having problems with:

FitValarr(i) = FitValarr(i) + Poparr(i, counter) * 2 ^ (j - 1) 

I apologize, I am fairly new to VBA.

  • 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-11T20:47:38+00:00Added an answer on June 11, 2026 at 8:47 pm

    An overflow condition arises when you create an integer expression that evaluates to a value larger than can be expressed in a 16-bit signed integer. Given the expression, either the contents of FitValarr(i), or the expression 2^(j-1) could be overflowing. Suggest all the the variables presently declared as Int be changed to Long. Long integers are 32-bit signed values and provide a correspondingly larger range of possible values.

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

Sidebar

Related Questions

I've having this problem with some JavaScript code. I've simplified it in the error
i am having a problem creating RMIserver class because i keep getting this error
I'm having this problem where I keep getting this error in my console: *
I'm having a problem where I receive this error: Exception in thread main java.lang.NullPointerException
I am new to OOP having this code and am having a problem creating
I'm trying to create this JSON string but having problem creating it. I'm getting
I am having problem with this javascript function. If I want to submit a
I am having problem getting this piece of code to run. The class is
I'm not a MySQL expert and am having problem with this... So, I have
I have this problem having to display my jasper report on my grails application.

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.