jeudi 30 septembre 2021

Debug assertion failed Expression: C++ vector subscript out of range

I have coded my meta-heuristic math model in C++ and I used CPLEX to solve the two mini math models within my code to get the initial feasible solution. to speed up the process I want to limit the number of possibilities in each mini math model to make sure the model does not go over all possibilities. my problem now is when I ower the limit, in some instances at a certain number it gives me the " Debug assertion failed Expression: C++ vector subscript out of range" error.

here is the part of my code that I used the limits.

//top of the code
const long int maxNumPRAPerCourse = 7;
const long int maxNumPf2fPerCourse = 7;
bool KeepGoing = true;

while (KeepGoing == true && RoomPossibilities[c].size() < maxNumPRAPerCourse) { 
 
//////solving the first mini math model//////

}
while (KeepGoing == true && RoomPossibilities[c].size() < maxNumPf2fPerCourse) { 
 
//////solving the second mini math model//////

}

in this particular case, with the limit set to 7, it works but when I change it to 6, it gives the error.

Aucun commentaire:

Enregistrer un commentaire