[FlopCpp] Strange Debug Assertion Error

Christian Wöllenstein WoelliUSM at aol.com
Tue Nov 6 10:06:26 EST 2007


Dear all,

I get a strange errormessage:

"Debug Assertion Failed"
[...]
"Expression: invalid null pointer"

In this case, I think it is a FlopC++-Error and I want to explain why, 
but first of all the code:

#include "flopc.hpp"
using namespace flopc;
#include <OsiCbcSolverInterface.hpp>
int main() {

MP_model m1(new OsiCbcSolverInterface);
enum{r36,r34,numRooms};
enum{d30,numDays};
enum{h36,h37,numHours};
enum{l85,numLessons};

MP_set r(numRooms);
MP_set d(numDays);
MP_set h(numHours);
MP_set l(numLessons);
MP_subset<2> rf(l,r);

rf.insert(l85,r34);
MP_data brc(r,d,h);
MP_data clr(l,r);
MP_data prf(l);
prf(l85)=100000;
brc(r34,d,h)=100;
brc(r36,d,h)=30;
clr(l85,r34)=50;
clr(l85,r36)=50;

MP_binary_variable x(r,d,h,l);
MP_binary_variable nrf(l,r);
MP_expression ZF;
//x.upperLimit(r34,d,h,l)=0;

MP_constraint allassigned(l);
MP_constraint roomcapacity(r,d,h);
MP_constraint rfix(l,r);

ZF=sum(r*d*h*l,x(r,d,h,l))+sum(r*l.such_that(rf(l,r)),nrf(l,r)*prf(l));
allassigned(l)=sum(r*d*h,x(r,d,h,l))==1;
roomcapacity(r,d,h)=sum(l,x(r,d,h,l)*clr(l,r))<=brc(r,d,h);
rfix(l,r).such_that(rf(l,r))=sum(d*h,x(r,d,h,l))+nrf(l,r)==1;
m1.minimize(ZF);
}

I do have one lesson "l85". This lesson should be assigned to a certain 
slot. There is one day with two hours (=> two slots). Also, there are 
two rooms.
There are three constraints:
1. (allassigned) This lesson should be assigned only once. 
2. (roomcapacity) There have to be enough seats in the room.
3. (rfix) There is one preferred room. If the lesson is not assigned to 
this room, this will be punished.

In this example, room "r34" is preferred. If this constraint is 
violated, the binary variable nrf is 1 and with punishment prf=100000. 
This will be violated, because in room "r34" are not enough seats to 
host Lesson "l85". While running the program, the strange error message 
occurs.

Now it's getting more strange: If I bound variable x to 0 (see 
x.upperLimit(r34,d,h,l)=0;), concerning the preferred room, there is no 
error message and everything works great!!

Thanks in advance,

Christian Wöllenstein




More information about the FlopCpp mailing list