Beispiel #1
0
        public static Input Parse(string fileName)
        {
            var input = new Input();
            using (var reader = new StreamReader(fileName))
            {
                input.NbTurns = ReadInt(reader);

                var nbSat = ReadInt(reader);
                for (int i = 0; i < nbSat; i++)
                {
                    var line = ReadMulti(reader);
                    var sat = new Satellite(
                        lat: line[0],
                        lon: line[1],
                        speed: line[2],
                        rotSpeed: line[3],
                        maxRot: line[4],
                        id: i);
                    input.Satellites.Add(sat);
                }

                var nbCollec = ReadInt(reader);
                var picId = 0;
                for (int i = 0; i < nbCollec; i++)
                {
                    var line = ReadMulti(reader);
                    var collec = new PicCollection(line[0], picId);
                    var nbLoc = line[1];
                    picId += nbLoc;
                    for (int j = 0; j < nbLoc; j++)
                    {
                        var loc = ReadMulti(reader);
                        collec.Locations.Add(new Coords {Lat = loc[0], Lon = loc[1]});
                    }
                    var nbRanges = line[2];
                    for (int j = 0; j < nbRanges; j++)
                    {
                        var time = ReadMulti(reader);
                        collec.TimeRanges.Add(new TimeRange(time[0], time[1]));
                    }
                    input.Collections.Add(collec);
                }
            }
            return input;
        }
Beispiel #2
0
 private static float Score(PicCollection picCollection, PartialSolution sol)
 {
     var completion = 0;
     var stop = picCollection.BasePicId + picCollection.Locations.Count;
     for (int i = picCollection.BasePicId; i < stop; i++)
     {
         if (sol.PicturesTaken.Get(i))
             completion++;
     }
     float x;
     if (completion == picCollection.Locations.Count - 1)
         x = 10f;
     else
         x = (float) (completion + 1)/(picCollection.Locations.Count + 1);
     return x*x*picCollection.Value/picCollection.Locations.Count;
 }