0xC0000005: Violation d'accès lors de la lecture
manel1989
Messages postés
10
Date d'inscription
Statut
Membre
Dernière intervention
-
Char Snipeur Messages postés 9813 Date d'inscription Statut Contributeur Dernière intervention -
Char Snipeur Messages postés 9813 Date d'inscription Statut Contributeur Dernière intervention -
Salut tout le monde !
dans mon programme c++ , j'ai une erreur :
je sais pas où est le problème exactement , ci-dessous vous trouverez mon code :
merci d'avance pour toute aide
dans mon programme c++ , j'ai une erreur :
0xC0000005: Violation d'accès lors de la lecture de l'emplacement 0x0000001c
je sais pas où est le problème exactement , ci-dessous vous trouverez mon code :
#include <gecode/driver.hh> #include <gecode/int.hh> #include <gecode/minimodel.hh> #include <iostream> #include <vector> using namespace Gecode; using namespace std; class manel : public MaximizeScript { protected: IntVar gain1; static const int n=6;//nbre des testeurs static const int m=6;// nbre des noeuds IntVarArray a; public: manel(void) : a(*this,m*n,0,1),gain1(*this,0,100000) { Matrix <IntVarArray> X (a,m,n); vector<int> R1; R1.push_back(20);R1.push_back(10);R1.push_back(15);R1.push_back(5);R1.push_back(25);R1.push_back(30); vector<int> C1; C1.push_back(50);C1.push_back(30);C1.push_back(15);C1.push_back(15);C1.push_back(60);C1.push_back(20); vector<int> B1; B1.push_back(10);B1.push_back(15);B1.push_back(40);B1.push_back(50);B1.push_back(60);B1.push_back(70); vector<int> Dr1; Dr1.push_back(1);Dr1.push_back(1);Dr1.push_back(10);Dr1.push_back(5);Dr1.push_back(15);Dr1.push_back(15); vector<int> Dc1; Dc1.push_back(1);Dc1.push_back(2);Dc1.push_back(20);Dc1.push_back(15);Dc1.push_back(15);Dc1.push_back(15); vector<int> Db1; Db1.push_back(1);Db1.push_back(2);Db1.push_back(10);Db1.push_back(10);Db1.push_back(20);Db1.push_back(20); //int g [n][m] ; vector<vector<int>> g; for(unsigned int i=0; i < n; ++i) g.emplace_back(std::vector<int>(m)); g[0][0]=125;g[0][1]=150;g[0][2]=1;g[0][3]=0;g[0][4]=0;g[0][5]=0; g[1][0]=125;g[1][1]=150;g[1][2]=1;g[1][3]=0;g[1][4]=0;g[1][5]=0; g[2][0]=125;g[2][1]=150;g[2][2]=1;g[2][3]=0;g[2][4]=0;g[2][5]=0; g[3][0]=125;g[3][1]=150;g[3][2]=1;g[3][3]=0;g[3][4]=0;g[3][5]=0; g[4][0]=125;g[4][1]=150;g[4][2]=1;g[4][3]=0;g[4][4]=0;g[4][5]=0; g[5][0]=125;g[5][1]=150;g[5][2]=1;g[5][3]=0;g[5][4]=0;g[5][5]=0; /*for(int i=0; i<n; i++) { for (int j =0; j<m;j++) g[i][j]=50; }*/ //creation of constraints // ... over rows for ( int j=0; j<n;j++) { linear(*this , X.row(j),IRT_EQ,1); } //... over columns for (int i = 0; i < m; i++) { linear(*this, Dr1,X.col(i),IRT_LQ,R1[i]); } for (int i = 0; i < m; i++) { linear (*this, Dc1, X.col(i), IRT_LQ,C1[i]); } for (int i = 0; i <m; i++) { linear (*this, Db1, X.col(i), IRT_LQ,B1[i]); } //objectiv function IntArgs res(m*n); IntVarArgs X1(m*n); IntVarArgs f(n*m); IntVar z; int count=0; int count1=0; int count2=0; int count3=0; for (int i=0; i<n; i++) { for (int j=0; j<m; j++) { res[count] = g[i][j]; count++; X1[count1] = X(i,j); count1++; rel(*this,z==res[count]*X1[count1]); f[count2]=z; count2++; } } // constraint over the objective function // linear(*this, f, IRT_EQ, gain);*/ //Branching branch(*this, a, INT_VAR_SIZE_MAX(), INT_VAL_MAX()); } virtual IntVar cost(void) const { return gain1; } /// Print solution virtual void print(void) const { std::cout << a << std::endl; } // Constructor for cloning \a s manel(bool share, manel& s) : MaximizeScript(share,s) { // gain.update(*this, share, s.gain); a.update(*this, share, s.a); } // Copy during cloning virtual Space* copy(bool share) { return new manel(share,*this); } }; int main(int argc, char* argv[]) { manel* m = new manel; if (manel* s = bab(m)) { s->print(); delete s; //Or whatever } /*Options opt("MMKP"); // opt.solutions(0); opt.parse(argc,argv); Script::run<manel,BAB,Options>(opt);*/ system("pause"); return 0; }
merci d'avance pour toute aide
A voir également:
- 0xC0000005: Violation d'accès lors de la lecture
- Erreur 0XC0000005 votre application... ✓ - Forum Windows
- XP Ecran bleu 0X0000008E (0XC0000005, ... aidez-moi SVP - Forum Windows