|
Hi CPallini,
thank you for you reply.
Nitheesh
|
|
|
|
|
dear friends
the following code is right? i would like to assign :
createArray(a);//initialize 10 3x4 arrays
fitFunc(fitness);//one arrays containing 10 values
double minValue = fitness[9];
for (int i =0;i<10;i++)
{
if (fitness[i] < minValue)
{
minValue = fitness[i];
gbest[i][3][4]=a[i][3][4];
cout << " "<< gbest[i][3][4]<<endl;
}
}
thanks a lot..urgent
Li Zhiyuan
5/10/2006
|
|
|
|
|
li zhiyuan wrote: the following code is right?
If it accomplishes your intended purposes, then yes.
I mean:
You're computing the minimum value of fitness array (and storing it into minValue ) and each time you find a currently mininmum value, say fitness[k] , you copy the corrensponding a[k][3][4] element into gbest[k][3][4] (all other
gbest elements remaining untouched) eventually displaying the copied element.
Is the above your target?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
modified on Saturday, January 26, 2008 5:42:07 AM
|
|
|
|
|
dear friends
i mean:
fitness[10] has 10 elements..when i get minimum of fitness[10], then i should know which position of fitness, for example:fitness[6] or fitness[8]..and so on....
and then i will assign corresponding a[i][3][4] to gbest[i][3][4]...because i finally use gbest[i][3][4]....if the fitness[6] is the minimum value of fitness[10]..then i assign a[6][3][4] to gbest[6][3][4]...
thanks
Li Zhiyuan
5/10/2006
|
|
|
|
|
li zhiyuan wrote: fitness[10] has 10 elements..when i get minimum of fitness[10], then i should know which position of fitness, for example:fitness[6] or fitness[8]..and so on....
Then you have to update also an index when you update the minimum, for instance
int minIndex;
minIndex = 9;
double minValue = fitness[minIndex];
for (int i =0;i<10;i++)
{
if (fitness[i] < minValue)
{
minIndex = i;
minValue = fitness[minIndex];
}
}
at the end, you know, for instance that minimum value (that correnspond to minValue ) is in fitness[minIndex] .
li zhiyuan wrote: and then i will assign corresponding a[i][3][4] to gbest[i][3][4]...because i finally use gbest[i][3][4]....if the fitness[6] is the minimum value of fitness[10]..then i assign a[6][3][4] to gbest[6][3][4]...
Sorry I don't understand the above.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
thanks brother
the problem is that: i can't assign a[i][3][4] to gbest[i][3][4]....
the code is following:
createArray(a);//create 10 3x4 arrays
fitFunc(fitness);//calculate fitness vale of one array containing 10 values
double minValue = fitness[9];
for (int i =0;i<10;i++)
{
if (fitness[i] < minValue)
{
minValue = fitness[i];
cout <<endl<<" " <<"Position of minimum fitness value :"<<" "<<"minimum value is :"endl;
cout<<" " << i<<" "<< minValue<<endl;
gbest[i][3][4]=a[i][3][4];
cout << " "<< gbest[i][3][4]<<endl;
}
}
so brother, the problem is in gbest[i][3][4] = a[i][3][4];...above this point, it is right...
Li Zhiyuan
5/10/2006
|
|
|
|
|
Why can't you? Do you get an error?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
compilation had no errer...but the result is wrong.
just i got one value from equation gbest[i][3][4]=a[i][3][4]...not 3x4 array..so what happened? i dun know? too urgent...i have a little things to finish..but cost too my whole day...thanks..brother
Li Zhiyuan
5/10/2006
|
|
|
|
|
if you need to copy the whole 3x4 array you can use one of the following approaches:
(1) use an iteration over all the array elements, i.e. change from
gbest[i][3][4]=a[i][3][4];
(BTW, the above code is wrong, you're accessing elements out of the array boundaries)
to
for (j=0; j<3; j++)
for (k=0; k<4; k++)
gbest[i][j][k]=a[i][j][k];
(2) do a crude copy of memory, i.e. change
gbest[i][3][4]=a[i][3][4];
to
memcpy(&gbest[i], &a[i], 3*4*sizeof(a[0][0][0]));
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
thanks friend, i solved problem, by the way, how to plus elements of two multiarrays?
i mean it will plus corresponding position value of two multiarrays?thanks
Li Zhiyuan
5/10/2006
|
|
|
|
|
li zhiyuan wrote: how to plus elements of two multiarrays?
i mean it will plus corresponding position value of two multiarrays?thanks
Please elaborate, I don't understand.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
hi am using vc++ mfc and pocket pc6.0.
i has 2 file in a same name.
1.windows\paul
2.temp\paul
i was used a code shellexecuteex to open files.
but it defaultly open windows\paul file.
to change the folder, what is the procedure?
can anybody help me?
paulraj
|
|
|
|
|
You can use this way.
#include <fstream>
std::fstream fw("C:\\WINDOWS\\paul", std::ios::in);
std::fstream ft("C:\\temp\\paul", std::ios::in | std::ios::out | std::ios::app);
Maxwell Chen
|
|
|
|
|
gnanapaul wrote: to change the folder, what is the procedure?
SetWorkingDirectory() , but changing folders is not necessary just to open a file.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Sorry, the two previous answers are not relevant.
Windows CE knows nothing about a current directory or a path environment variable.
Always provide a Unicode full path beginning at the root like L"\\windows\\paul\\filename.ext" .
cheers,
AR
|
|
|
|
|
Hi,
I want to login a website eg aaa.com
so I do this,
I use SendRequest send my username an password
pFile->AddRequestHeaders("Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*");
pFile->AddRequestHeaders("Referer: http://www.boofdollars.com/index.php?view=login&");
pFile->AddRequestHeaders("Accept-Language: zh-cn");
pFile->AddRequestHeaders("Content-Type: application/x-www-form-urlencoded");
pFile->AddRequestHeaders("Accept-Encoding: gzip, deflate");
pFile->AddRequestHeaders("User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Maxthon; .NET CLR 2.0.50727)");
pFile->AddRequestHeaders("Host: www.boofdollars.com");
pFile->AddRequestHeaders("Content-Length: 80");
pFile->AddRequestHeaders("Connection: Keep-Alive");
pFile->AddRequestHeaders("Cache-Control: no-cache");
pFile->AddRequestHeaders("Cookie: "+cookie_);
pFile->AddRequestHeaders("returnTo=&id=&ac=stats&step=&ptype=&form_user=goodhere&form_pwd=goodhere");
pFile->SendRequest(NULL,0,lpOptional,strlen(lpOptional));//80 bytes skipped. Reason: The content type is not captured.
Why?
I must creat a cookie?
Thank you
|
|
|
|
|
What is the problem you are having?
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
Hi,
Is there any API/”MFC’s class method” to check if a particular database provider (Oracle, SQL etc.) is installed or not?
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
|
|
|
|
|
What about trying to connect?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Does this help?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi All,
If I run the Activex Control Test Container Application to test the activex control, the Test Container application either crashes or dumps an "unspeifified error" as "Microsoft Development Environment has encounters a problem and need to close".
Help me to fix the error!
|
|
|
|
|
hi
i have a application in windows mobile that is to create a ini file.
in nthe same ini file i must write data and read the data
k.guru moorthy
|
|
|
|
|
|
// select suitable seedwave file for the deck
CString file_now;
s_dis=0;
int ii=0;
file_now=ftitle[0];
s_dis=sd_dis[0];
//
do {
file_now=ftitle[ii];
s_dis=sd_dis[ii];
//
ii =ii+1;
//
} while (ii<nfile && sd_dis[ii]<dis);
//
I debudg my program I got "Access Violation" at ii=ii+1; all other variables print value correctly. I really do not know what is the problem ?
Thanks for the help
|
|
|
|
|
mrby123 wrote: I debudg my program I got "Access Violation" at ii=ii+1;
What is the value of ii at this point?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|