Modifying the initial order of the activities

Started by Liviu Lalescu, July 29, 2011, 12:08:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Liviu Lalescu

A user, yush, wanted to change the initial order in which FET tries to place the activities.

I write down my email correspondence with yush (Yush Yuen), and attach the resulted modified file. Correspondence was done near the date of 2011-05-25.

---------------

yush:
  A question: is there anyway to force some activities to be placed earlier?


Liviu:

FET places firstly activities fixed in time and space (only one allowed time
slot, only one allowed room) (these have conflicts weight 2,000,000,000), then
those fixed only in time (these have conflicts weight 1,500,000,000), then the
others in the order of their difficulty (number of other activities with which
they conflict + other factors).

It is possible for you to:

1) Fix these activities in time (maybe also in space);

2) Change the FET code (I could help).

But the question is "why"? :-)


yush:

I know it probably won't help, but I just wonder if it would help if I can
put first the activities that usually cause problem toward the end of the
generation.

Likely, if I put some activities earlier, some other activities will cause
problem instead.

But I think it's worth a try.

Fixing it in time means that the activities will not be able to float, may
cause more problem later. Don't think it will help much.

Allowing user to have custom order has other benefit. I may have activities
that is "less important", and therefore keep it at the end. And if it
doesn't workout, I can just ignore them or find administrative solution.


Liviu:

Yes, putting difficult activities first will make the others difficult. But
the other reason is good.

Please see generate_pre.cpp, line 7647. After this line, you need to insert
code to change the order.

Each activity has an index, from 0 to gt.rules.nInternalActivities-1. This is
in the order of input. If you inputted A1, A2, A3, then index 0 means A1,
1->A2, 2->A3.

permutation[0] is the most difficult act., then permutation[1] and then
permutation[2] easiest (in our example).

If array permutation is: permutation[0]=1, permutation[1]=2, permutation[2]=0,
then the initial order of activities (in generation), is: A2, A3, A1.

You need to put permutation [ x ] = y for each activity, for each x from 0 to
gt.rules.nInternalActivities, and each y should be different.

So, in our example, for order A3, A2, A1, add, after line 7647:

permutation[0]=2;
permutation[1]=1;
permutation[2]=0;

Then recompile.

Please let me know if this method is suitable for you or it is too much to
write, maybe there is another possibility if this one is bad.


yush:

I see... can you tell me how I can access the activity tag of each activity?

I am thinking, I can hard code a custom activity_tag, call it put_order:##

then I can have a way in from the interface to change the order instead of
having to recompile all the time.

I think I can try to code it... haven't done C for so long.


Liviu:

Very good idea! I did not see it.

This is how I think (maybe you already thought of these): add an activity tag,
like you said, put_order##6 say for place 6. Then put all activities with
order 1 firstly, then 2, ... . In case of equality, sort by FET official
means.

In fact, this may be considered for official FET, at least as a suggestion.
Could you resume your request and your/my thoughts/answers in some phrases,
and I'll add it in the TODO?

Let me try this for you, because it won't take me long. Maybe I'll send in 30
minutes a solution.


Liviu:

Please use attached. Add tags put_order##x , where x is any reasonable integer
number (may be negative, but must be lower than 2 000 000 000). Any problem
will be reported.

Please check my work, whenever possible: in the command line, see initial
order reporting, immediately after starting to generate. You may run "./fet
>output" and see the beginning of the output file.


yush:

The put_order hack is working great. I am now playing with it to see if it
does give me an edge. It will take me a while to have a conclusion.

Rephrasing the suggestion:

Feature: Allow user to customize the order of activities during the
generation.

Benefit: Usually, a few activity converge to be "more difficult" toward the
end of the generation. It might be beneficial (unproven) to put those
activity earlier rather then later. Also, I can force some "important"
activities to be completed first, and some "unimportant" ones to be
completed later.

Suggested solution: Add a "generate order" text box in the add/modify
activity form. Values to be taken are 0-100%. The percentile represent what
percentile out of all the activities should this one be placed. 0 = default
(according to the original order)

Of course, there could be a dedicated form just to manage generation order,
but we know how much we hate interface :).

The current activity_tag is a good hack. In fact, activity_tag is such a
flexible model, it is a quick and dirty way to "sleek" information into the
program without building additional interface.


yush:

You mean the put order thing. Are you going to just use the put_order##
activity tag method as we have it now, or have a proper value entry box?

It would be nice if you can make it an "advance feature", so user can turn
on or off the feature. It's useful for cases where I have added a lot of
custom put order, then want to see how it work with or without it. Probably
a setting check/uncheck under the menu.


Liviu:

About order of activities, this is more complicated and I might consider it
for the next versions, but I am not sure. I would prefer with an order, 0
default, negative for higher priority and positive for lower priority, yes,
turn on/off like you said.


Liviu:

You wrote that you need to be able to suppress custom ordering of activities.
I can tell you how to do that in your custom version, let me know if you still
need it. I think of simply adding another activity tag (either a single one
for all activities, or the same tag for each anihilated activity, like
"cancel_order##".


yush:

By the way, my hope of moving particular "difficult" activity to top of the
order didn't help much. As suspected, once an activity is moved, everything
change, and what was difficult for one seed may not be for another.

Liviu Lalescu

This facility will be implemented in FET-5.23.0.

fifii

where can I find this facility?

I'm using Version: 5.23.2 (August 2014).


Liviu Lalescu

Menu Advanced -> Group activities in the initial order of generation, or Timetable -> Advanced tab button.

You need to enable first, from Settings -> Advanced.