samedi 31 octobre 2015

how to optimize this code and getting access to it or is there another way to write it? [on hold]

i want to implement a vector that has a type of matrices and this matrices has a type of a list of class(class name:classe) so i create a class schedule and a type of list of class like this:

/*
 * schedule.h
 *
 *  Created on: 29 Oct 2015
 *      Author: Latitude
 */

#ifndef SCHEDULE_H_
#define SCHEDULE_H_
#include <string>
#include "Classe.h"
#include <list>

typedef std::list<Classe*> ClasseListeType;


class schedule {
public:
    schedule;
    virtual ~schedule();

    ClasseListeType GetMat(int i,int j) { return  *Mat[i][j]; }


private:
    std::string _lannee;
    int  nbrofdays;
    int  nbrofslots;

     ClasseListeType*  Mat[nbrofdays][nbrofslots] ;

    //std::list<Classe*> _listedsclasse;
    //Mat[nbrdsjours][nbrdsperiods];
};

#endif /* SCHEDULE_H_ */

and i fill the Schedule list by this code

  c2(2,2,&p1,&g1,&m4),
       c3(3,3,&p1,&g1,&m5),
       c4(4,1,&p2,&g1,&m2),
       c5(5,2,&p2,&g1,&m6),
       c12(12,2,&p4,&g1,&m8),
       c13(13,1,&p4,&g1,&m7),
       c6(6,1,&p1,&g2,&m1),
       c7(7,2,&p1,&g2,&m4),
       c8(8,3,&p1,&g2,&m5),
       c9(9,1,&p2,&g2,&m2),
       c11(11,2,&p2,&g2,&m6),
       c14(14,1,&p4,&g2,&m7);

    Schedule lp;


       lp.GetMat(0,0).push_back(&c1);
       lp.GetMat(0,0).push_back(&c9);
       lp.GetMat(0,1).push_back(&c3);
       lp.GetMat(0,2).push_back(&c4);
       lp.GetMat(0,3).push_back(&c7);
       lp.GetMat(0,1).push_back(&c6);
       lp.GetMat(0,4).push_back(&c8);
       lp.GetMat(0,2).push_back(&c2);
       lp.GetMat(0,4).push_back(&c11);
       lp.GetMat(0,3).push_back(&c13);


         vector<Schedule*> 

So i'm not so sure for this code Hide Copy Code because it seems so complicated and i have to manage this code with genetic algorithm and vector<Schedule*> will be the chromosome vector<Schedule*> will be the chromosome`

how do i access this lists in easy way ??

so is there an eny erreur on my code or i didt in a wrong way plz help me to optimize it; tanks i advenced

Aucun commentaire:

Enregistrer un commentaire