Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: IndexError: invalid index to scalar variable.
Post: RE: IndexError: invalid index to scalar variable.

(Mar-10-2022, 09:36 AM)ibreeden Wrote: "fitness_function(position)" expects an array (or list or any iterable) of exactly 15 elements. When you do: fitness_function(particle_position_vector[i])... y...
jyotib2610 Data Science 3 3,161 Mar-10-2022, 09:55 AM
    Thread: IndexError: invalid index to scalar variable.
Post: RE: IndexError: invalid index to scalar variable.

Here, I have posted the code with an error. Please help me. import random import numpy as np import math import matplotlib.pyplot as plt def fitness_function(position): s1=0.014109786*position...
jyotib2610 Data Science 3 3,161 Mar-10-2022, 06:39 AM
    Thread: IndexError: invalid index to scalar variable.
Post: IndexError: invalid index to scalar variable.

I got the error as "IndexError: invalid index to scalar variable.", while trying this PSO algorithm problem. I also want to plot a graph between iteration number and fitness value. Kindly help me with...
jyotib2610 Data Science 3 3,161 Mar-10-2022, 06:06 AM

User Panel Messages

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