Constrain wrong? wrong solution

10 views
Skip to first unread message

yleme

unread,
Dec 23, 2010, 10:50:24 AM12/23/10
to am...@googlegroups.com

Hallo everybody,

I poste here my constrain, wich is wrong (maybe).

subject to Restrektion_2_7{a in Aufsichtsperson,p in Prufungen,k in
Prufungen:p<>k and floor(n[p])=floor(n[k])}: x[a,p]+x[a,k]<= (if
(round(n[p]-floor(n[p]),4)+l[p]+0.01 >= round(n[k]-floor(n[k]),4)) then 1
else 2);

My goal: I have supervisors and exams. 1 supervisor can (at the same
day->floor(n[p])=floor(n[k]) ) supervise only one exam at the same time. so
if the end of the exam p is >= the beginning of the exam k then the person a
can supervise the exam p or k but not both. So what is wrong with my
constrain? I am sure it is something wrong because i get wrong solutions.
Pleas help me!

Thanks!
--
View this message in context: http://old.nabble.com/Constrain-wrong--wrong-solution-tp30523103p30523103.html
Sent from the AMPL mailing list archive at Nabble.com.

Paul

unread,
Dec 23, 2010, 5:10:16 PM12/23/10
to AMPL Modeling Language
It's hard to say what is wrong without knowing more about n[] and
lp[], but as a start I suggest that after building the model and
reading in the data you execute the command

expand Restrektion_2_7;

in AMPL. That will print out all instances of this constraint; you
can look through them and see if any that should be present are
missing or malformed.

/Paul

yleme

unread,
Dec 25, 2010, 5:37:54 AM12/25/10
to am...@googlegroups.com

Thanks Paul.
Your are right. I shoudt explain my paarameters. n[p] is the exampoint( for
example 40333,3542 = 04.06.2020 at 8:30 starts the exam p). l[p] is the
length of the exam p. So i need a constrain: If it is the same day and the
start of the exam p + the lenght of the exam p + 0.01 is biger or equal then
the start of the exam k then a person can supervice only one or 0 exam and
not both (k and p). As the answer i get integer infeasible and with expand
Restrektion_2_7; i get everywhere 0. And this is wrong because i have the
datas and there is a integer solution and with expand Restrektion_2_7; i
must get some 1.
I appresiate for a answer!

> --
> You received this message because you are subscribed to the Google Groups
> "AMPL Modeling Language" group.
> To post to this group, send email to am...@googlegroups.com.
> To unsubscribe from this group, send email to
> ampl+uns...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/ampl?hl=en.
>
>
>

--
View this message in context: http://old.nabble.com/Constrain-wrong--wrong-solution-tp30523103p30531445.html

Paul

unread,
Dec 25, 2010, 11:22:02 AM12/25/10
to AMPL Modeling Language

> Thanks Paul.
> Your are right. I shoudt explain my paarameters. n[p] is the exampoint( for
> example 40333,3542 = 04.06.2020 at 8:30 starts the exam p). l[p] is the
> length of the exam p.

Mathematically, there is nothing wrong with using real values for n[]
and l[], but most people doing timetabling models will partition the
planning horizon into discrete blocks (for instance, half-hour
intervals) and then use integers for the start time and duration.
That avoids the necessity of rounding, floor function, .01 tolerance
etc.

> with expand
> Restrektion_2_7; i get everywhere 0.

I don't understand what you mean by this. Are you saying that the
right-hand sides are zeros (they should be 1 or 2), or that the
coefficients on the left are all zero, or what? Perhaps you could
post what AMPL outputs for one of the instances of Restrektion_2_7
when you expand it.

/Paul
Reply all
Reply to author
Forward
0 new messages