## עבודה 5 - מספר שאלות

rvn
הודעות: 39
הצטרף: 23:05 14/11/2008
מיקום: מעונות ג'

### עבודה 5 - מספר שאלות

נור אשמח אם תוכלו לענות לי על מספר שאלות לפני מועד ההגשה...

1. Comparable causes a warnning, should we @supress is?

2. I called data "private" but didn't copy it in RegressionIndividual - the way it's currently setup (with RegressionEvolution only calling the super with everything) the only place I could copy it is in the RegressionIndividual constructor and it'd be a shame to copy the entire thing every time we create an Individual... So it's basically "private" but still accessible by the calling function, is it ok?

3. The instructions say that both mutate and crossover should return a new individual as should reproduce (even if no changes were done) - Can I just create a new copy at the beginning of reproduce and have crossover and mutate modify it (ans "return this") and only reset the fitness on the new Object if an actual change was made?

4. Can I assume that the population will have at least 2 Individuals? If so I can easily add a while loop to prevent a crossover with the same Individual (Of course crossover may still occur between two Individuals which have the same genome, but I'd assume it's ok)?

5. I only now noticed that the polynomial was actually a 5th degree one with the coefficient of x^2 being zero should I skip looking for x^2? It's fast enough with all 6 items (finding it's coefficient to be 0)...
It makes my POLYNOMIAL_DEG constant sound misleading... >_<

6. how do I define a const (or do I have to use final static?)? I thought it'd be possible to evaluate these while compiling?

7. the merge sort uses temporary split arrays as was shown in the ppt demo algorithm, should I remake it to be more efficient?

8. does it matter if a is the x^0 or x^5 coefficient?

danny
הודעות: 64
הצטרף: 12:32 23/10/2009

### Re: עבודה 5 - מספר שאלות

to 4: it does seem unlikely to have a population of such small size (such as one).
Nevertheless, there has been a post regarding the issue of having a CLONE - that is, having one individual as both parents.

What I'm trying to say is that it's acceptable to have a clone, so you might as well abandon looking for two different individuals.
If all else fails - we always have mutation..
Error is Created. Truth is Eternal. Error, or Creation, will be Burned up, & then, & not till Then, Truth or Eternity will appear

danny
הודעות: 64
הצטרף: 12:32 23/10/2009

### Re: עבודה 5 - מספר שאלות

to 8: a being the x^5 coefficient (that is - the 1st 7 bits from the left of the genome)
Error is Created. Truth is Eternal. Error, or Creation, will be Burned up, & then, & not till Then, Truth or Eternity will appear

Lecturer_Sipper
הודעות: 111
הצטרף: 17:41 05/11/2008

### Re: עבודה 5 - מספר שאלות

rvn כתב:נור אשמח אם תוכלו לענות לי על מספר שאלות לפני מועד ההגשה...

1. Comparable causes a warnning, should we @supress is?

2. I called data "private" but didn't copy it in RegressionIndividual - the way it's currently setup (with RegressionEvolution only calling the super with everything) the only place I could copy it is in the RegressionIndividual constructor and it'd be a shame to copy the entire thing every time we create an Individual... So it's basically "private" but still accessible by the calling function, is it ok?

3. The instructions say that both mutate and crossover should return a new individual as should reproduce (even if no changes were done) - Can I just create a new copy at the beginning of reproduce and have crossover and mutate modify it (ans "return this") and only reset the fitness on the new Object if an actual change was made?

4. Can I assume that the population will have at least 2 Individuals? If so I can easily add a while loop to prevent a crossover with the same Individual (Of course crossover may still occur between two Individuals which have the same genome, but I'd assume it's ok)?

5. I only now noticed that the polynomial was actually a 5th degree one with the coefficient of x^2 being zero should I skip looking for x^2? It's fast enough with all 6 items (finding it's coefficient to be 0)...
It makes my POLYNOMIAL_DEG constant sound misleading... >_<

6. how do I define a const (or do I have to use final static?)? I thought it'd be possible to evaluate these while compiling?

7. the merge sort uses temporary split arrays as was shown in the ppt demo algorithm, should I remake it to be more efficient?

8. does it matter if a is the x^0 or x^5 coefficient?

1.
http://myforum.bgu.ac.il/phpBB3/viewtop ... 127&t=4662

2. http://myforum.bgu.ac.il/phpBB3/viewtop ... 127&t=4833
http://myforum.bgu.ac.il/phpBB3/viewtop ... 127&t=4828

3. Don't deviate from instructions.

4. Cannot assume, and don't add loop...

5. The polynomial should be exactly as in assignment definition.

6. You can use final.

7. mergesort of class is fine.

8. Yes, it matters. The polynomial should be exactly as in assignment definition.
פרופסור משה זיפר
מרכז הקורס "מבוא לתכנות למערכות מידע"
http://www.moshesipper.com

rvn
הודעות: 39
הצטרף: 23:05 14/11/2008
מיקום: מעונות ג'

### Re: עבודה 5 - מספר שאלות

thanks guys for the quick anwsers, really appreciate it! =)

rvn
הודעות: 39
הצטרף: 23:05 14/11/2008
מיקום: מעונות ג'

### Re: עבודה 5 - מספר שאלות

אי אפשר לתחום את הלולאה שמחפשת איבר אחר בתנאי ש קיים יותר מאיבר אחד לקרוס-אובר? בלי זה יש לי הרבה יותר מינימום לוקאלי ^_^*