Auto_scheduling_strict

I am not sure to understand how auto_scheduling_strict work:

With this code:
gantt.config = {
…gantt.config,
fit_tasks: true,
auto_scheduling: true,
auto_scheduling_strict: false
};
gantt.init(‘gantt_here’);
gantt.parse({
data: [
{ id: 1, text: ‘Project #1’, start_date: ‘01-03-2019’, duration: 3 },
{ id: 2, text: ‘Project #2’, start_date: ‘07-03-2019’, duration: 2 },
{ id: 3, text: ‘Task #1’, start_date: ‘11-03-2019’, duration: 2 }
],
links: [{ id: 1, source: 1, target: 2, type: ‘0’ }, { id: 2, source: 2, target: 3, type: ‘0’ }]
});

I am expecting the project not to be rescheduled as no dates violates the constraint but I am feeling that it is rescheduling the whole project in a strict mode anyway

Hi @ouassim !

When strict mode is set to true, auto-scheduling arranges tasks as early as possible, so they follow exactly one after the other.
When it is set to false - auto scheduling only moves tasks when necessary - when the task needs to be moved forward due to dependency. So there can be free space between tasks.
It works only for the tasks that have the start link (source). It doesn’t work for the tasks that receive the link (target).
Check this please:
http://recordit.co/5kIhbz9SjO

Please note that by default the strict auto scheduling is not enabled in dhtmlxGantt 6.1. The logic of the task allocation is defined by the constraints.
https://docs.dhtmlx.com/gantt/desktop__constraint.html

To enable this setting, you need to turn on auto-scheduling compatibility mode with the previous version.
https://docs.dhtmlx.com/gantt/migrating.html#6061

If you want to recalculate the whole project please use gantt.autoSchedule().
https://docs.dhtmlx.com/gantt/api__gantt_autoschedule.html
Check this:
http://recordit.co/97C9WE4pYD

Hi!
We ae using the strict mode of the Autoschedule. However, we are facing a peculiar problem. Though, the strict mode is rescheduling the tasks to their earliest possible dates correctly but it is doing so irrespective of the fact that the task has an actual start date assigned to it. This is happening even if we have diabled auto scheduling of already started tasks.
We do not want the tasks to be scheduled to an earlier date if they have already started. Please advise.
Saurabh

Hello,
With the onBeforeTaskAutoSchedule handler, you can check if the start date of a task is earlier than today and, if so, cancel autoscheduling for that task:

const today = new Date(2023, 01, 07);
gantt.attachEvent("onBeforeTaskAutoSchedule", (task, start, link, predecessor) => {
    if (+task.start_date < +today) {
        return false;
    }

    return true;
});

Here is an example: https://snippet.dhtmlx.com/ixcx2hot. Please click on the “Autoschedule” button to see how it works.

Hi Maksim,
We are using the same logic as explained by you in your last answer. However, instead of using today’s date, we are using actual start date as a trigger for cancelling the auto-schedule for that particular activity. I.e. if there is actual start date available for any activity the same should not be rescheduled.
But still, if there is no predecessor for such an activity (which has started), the activity start date is rescheduled to project start date. This is not as per the expected behaviour. Please advice.

Hello,

Unfortunately I can’t reproduce this behavior without your code.
Could you record a screencast? And reproduce this behavior in the snippet https://snippet.dhtmlx.com/ixcx2hot and send it to me?

Please see an example https://snippet.dhtmlx.com/f9q6p6rd where if a task has a actual_start_date then it is ignored during autoscheduling. Maybe it will be useful for you.

If there is no predecessor link for a task and it is assigned a constraint. Autoscheduling_strict is enabled.
When Autoschedule button is pressed, the task is rescheduled to the project start date. We are using onBeforeAutoSchedule as false for all the tasks that have started. But still such activities are being rescheduled to project start date.
Please suggest a solution.

Regards
Saurabh

Hello,

Unfortunately, I’m unable to replicate the issue. Could you please attempt to reproduce the problem in the snippet: DHTMLX Snippet Tool and sharing it with us? Additionally, providing screenshots, sketches, or videos along with your commentary would be greatly appreciated.