Services dependencies

512 views
Skip to first unread message

David Miranda

unread,
Sep 30, 2015, 12:21:11 PM9/30/15
to jsprit-mailing-list
Hi,

I'm trying to model the following problem: I have services that can be, or not, dependent on another service, ie can only happen after that. Besides the dependency, it can also be the restriction of having to be performed on the same route.

I think I have to implement a restriction on the level of activity to ensure that a service is done before the other, and further restrictions on route level to ensure that they are on the same route. This is correct?


However I can not figure out how to replicate this for N services with dependencies.

Thanks in advance.
Message has been deleted

David Miranda

unread,
Oct 2, 2015, 12:41:15 PM10/2/15
to jsprit-mailing-list
Following this example: https://github.com/jsprit/playground/blob/master/src/stackoverflow/Stackoverflow_RelatedJobs_13_and_21_inSameRoute_21_first.java

If I have a job A and B, where B depends on A (should be done before B), the solutions given always put the B job in the first place. I implemented a soft constraint like the example above.

Why this continues to happen?

Thanks

He Huang

unread,
Oct 9, 2015, 4:21:14 AM10/9/15
to jsprit-mailing-list
Hi David,

I think you need to make sure it is rewarding to visit A before B, i.e., if you calculate the cost for "A before B" and "B before A" respectively, the former (including the rewards you set for "A before B", -100 in the example) should be smaller than the latter. Otherwise the algorithm will visit B before A because the cost is minimized.

Best regards,
He

Stefan Schröder

unread,
Oct 13, 2015, 3:15:45 PM10/13/15
to jsprit-mailing-list
Hi David,

sorry for answering that late, but I really do not have much time.

I can think of 3 relation types between two jobs A and B that can be modelled:

1. in-same-route: here you need to specify a hard constrait at route level. additionally, you need a route state that memorizes whether jobA or jobB has been inserted
2. in-sequence: here you need to define a hard constraint at activity level, and you require activity states that gives you - at each activity in the route - the information whether jobA/B has already been inserted
3. in-direct-sequence: here you do not need any state since this can be modeled just by defining a hard activity constraint.

If you modeled these relations between two jobs, it would be easy to generalize it for n jobs. For example to model that jobA,B,C,D need to be in direct sequence, you just
need to make sure that this is valid: in-direct-sequence(A,B) && in-direct-sequence(B,C) && in-direct-sequence(C,D).

Hope this helps.

Best,
Stefan
Reply all
Reply to author
Forward
0 new messages