Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace msi_lab_7
- {
- public class Individual
- {
- private double _leftEnd;
- private double _rightEnd;
- public List<bool> Chromosome { get; set; }
- public double Fitness { get; set; }
- public int Length
- {
- get
- {
- return Chromosome.Count;
- }
- }
- public Individual()
- {
- Chromosome = new List<bool>();
- }
- public Individual(Individual individual)
- {
- this.Chromosome = individual.Chromosome.Select(x=>x).ToList();
- this._leftEnd = individual._leftEnd;
- this._rightEnd = individual._rightEnd;
- }
- public Individual(int n, double p, double leftEnd, double rightEnd)
- {
- Chromosome = new List<bool>();
- for(int i = 0; i <n; i++)
- {
- Chromosome.Add(RandomHelper.NextBitValue(p) == 1 ? true : false);
- }
- _leftEnd = leftEnd;
- _rightEnd = rightEnd;
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement