FET Forum

Discussions and Chat => Programming and other Technical Help => Topic started by: ahmedzaalan on February 19, 2012, 05:19:10 PM

Title: How and when constraint's weight is considered in skipping it???
Post by: ahmedzaalan on February 19, 2012, 05:19:10 PM
hello!
I am trying to program your algorithm for an university project  i fellow your description of the algorithm ,
but I want to know when to break a constraint and how will the weight will affect this operation,
I thought to do the following:
Never break any constraint unless we tried all possible swaps and return with out success and if we are at level 0 I scan all slots with 'soft conflicts' (i mean slots with constraints violated) then i place the activity in the slot with the less number of violated constraint and if two or more are equal in the number of violated constraints i choose the slot with the less sum of weight  of the violated constraint.
-----------------------------------------------
It worked but i had some problems:
1)too much time for generation as no constraints are spiked testing during the swap level.
2)I am not sure that the best slot with violated constraints which was chosen in level 0 is the best practically for example :
if we have (MinDayBetWeenASetOfAcivities 2 ) some times the best slot chosen will be with 0 days between activities but some other slots are with 1 day so logically its better to put the activity at the second slot.
--------------------------------------------------------
what i am thinking to do is to find a way to break constraint during swap respecting the weight can you help me please.
Title: Re: How and when constraint's weight is considered in skipping it???
Post by: Liviu Lalescu on February 19, 2012, 05:48:13 PM
Quote from: ahmedzaalan on February 19, 2012, 05:19:10 PM
2)I am not sure that the best slot with violated constraints which was chosen in level 0 is the best practically for example :
if we have (MinDayBetWeenASetOfAcivities 2 ) some times the best slot chosen will be with 0 days between activities but some other slots are with 1 day so logically its better to put the activity at the second slot.

Try to add an activity in FET interface, with min days = 2. FET will instruct you to add also a second constraint, with min days = 1. This is my (hardly found, and maybe unique) solution to this problem.

Quote
what i am thinking to do is to find a way to break constraint during swap respecting the weight can you help me please.

Please see generate.cpp lines 3381 and below (FET-5.16.0 official). This is my (hardly found, and maybe unique) solution to this problem.