JamesBremner / Agents2Tasks

Assign agents to tasks in multiple timeslots
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Extra agent assigned to timeslot #44

Closed rejkid-tester closed 5 months ago

rejkid-tester commented 5 months ago

For the date "202402030600" only two "Cleaner" agents are needed. Why Agents2Tasks assigns three "Cleaner" agents?

a2t_result.txt

t 202402030600 Cleaner Cleaner Acolyte Acolyte Acolyte
...
A 202402030600 A_group to Cleaner
A 202402030600 rejkid@gmail.com&24-03-1961 in A to Cleaner
A 202402030600 ismith@gmail.com&02-07-1961 in A to Cleaner
A 202402030600 ablack@gmail.com&07-06-1998 to Cleaner                     !!!!
JamesBremner commented 5 months ago

The agent is assigned to the task as an individual, not as part of a group. When an agent is assigned as part of a group the assignment line includes "in (groupname)"

A 202402030600 A_group to Cleaner                                                           // group assignment
A 202402030600 rejkid@gmail.com&24-03-1961 in A to Cleaner              // part of group
A 202402030600 ismith@gmail.com&02-07-1961 in A to Cleaner             // part of group
A 202402030600 ablack@gmail.com&07-06-1998 to Cleaner                    // individual assignment
rejkid-tester commented 5 months ago

For the date "202402030600" only two "Cleaner" agents are needed. Why Agents2Tasks assigns three "Cleaner" agents?

JamesBremner commented 5 months ago

That seems like a much better question!

JamesBremner commented 5 months ago

I have fixed the error in your file and simplified it. I can now reproduce the problem

JamesBremner commented 5 months ago

Here is the explanation output:

C:\Users\James\code\Agents2Tasks\bin>Agents2Tasks.exe explain ..\dat\tid44.txt tid44.res
Unit tests passed

Assigning task Cleaner in slot 202402030600, available: ablack@gmail.com&07-06-1998 w0,  awhite@gmail.com&07-06-1998 w0,  iblack@gmail.com&02-07-1961 w0,  ismith@gmail.com&02-07-1961 w0,  iwhite@gmail.com&02-07-1961 w0,  rejkid@gmail.com&24-03-1961 w0,  A_group w0,  B_group w0,  assigned: A_group
Assigning task Cleaner in slot 202402030600, available: ablack@gmail.com&07-06-1998 w0,  awhite@gmail.com&07-06-1998 w0,  iblack@gmail.com&02-07-1961 w0,  iwhite@gmail.com&02-07-1961 w0,  assigned: ablack@gmail.com&07-06-1998
Assigning task Acolyte in slot 202402030600, available:no available agents
Assigning task Acolyte in slot 202402030600, available:no available agents
Assigning task Acolyte in slot 202402030600, available:no available agents

It seems that the code has not registered that the assigning of group A has completed all the cleaner tasks. Odd! Strange that this problem has not been noticed before. I will take a look later. ( It is 3 months since I last looked at this code. )

JamesBremner commented 5 months ago

Simplified input still demos problem

a a 1 ablack@gmail.com Cleaner
a b 1 awhite@gmail.com Cleaner
a c 1 iblack@gmail.com Cleaner
a d 1 ismith@gmail.com Cleaner
a e 1 iwhite@gmail.com Cleaner
a f 1 rejkid@gmail.com Cleaner
g A Cleaner b c
t 202402030600 Cleaner Cleaner
A 202402030600 A_group to Cleaner
A 202402030600 b in A to Cleaner
A 202402030600 c in A to Cleaner
A 202402030600 a to Cleaner
JamesBremner commented 5 months ago

FYI I am still working on this. The code to assign group members to tasks is far to simple and must be rewritten to handle corner cases.

JamesBremner commented 5 months ago

Getting the correct results, no extra assignments in timeslot

a a 1 ablack@gmail.com Cleaner
a b 1 awhite@gmail.com Cleaner
a c 1 iblack@gmail.com Cleaner
a d 1 ismith@gmail.com Cleaner
a e 1 iwhite@gmail.com Cleaner
a f 1 rejkid@gmail.com Cleaner
g A Cleaner b c
t 202402030600 Cleaner Cleaner
A 202402030600 A group assigned
A 202402030600 b in A to Cleaner
A 202402030600 c in A to Cleaner
rejkid-tester commented 5 months ago

Hi James, I am getting this error when attempting to run Agents2Tasks.exe : image

and Norton antivirus complains that "Suspicious process attempted to modify security attributes of a file protected by Data Protector"

"

JamesBremner commented 5 months ago

As the error message tells you, it cannot find an input file. Since you have not yet seen the unit test report, it is looking for one of the unit test files. Probably you have not cloned the repo, or maybe you are not running from the repo bin folder.

JamesBremner commented 5 months ago

Here are the unit test files needed

image

JamesBremner commented 5 months ago

In future, please post the text from a command window. It is much easier to deal with than a screenshot.

rejkid-tester commented 5 months ago

I am running Agents2Tasks.exe from my application folder (is that wrong?). I have always run it this way and never had that problem before?

JamesBremner commented 5 months ago

You never had that problem before because there are new unit tests. You need to copy the unit test files to the location they should be.

So, if you move the executable to ../somefolder/app then you must copy the files to the corresponding folder ../somefolder/dat

rejkid-tester commented 5 months ago

OK. I have copied 'dat' folder to my production folder but still getting the same error?

JamesBremner commented 5 months ago

I have copied 'dat' folder to my production folder

I have no idea what you mean by "your production folder" Please carefully re-read https://github.com/JamesBremner/Agents2Tasks/issues/44#issuecomment-2150626498

Suggest you post the folder hierarchy you are using, highlighting where the executable and unit test files are.

JamesBremner commented 5 months ago

Also suggest you rebuild so as to take advantage of the latest commit.

JamesBremner commented 5 months ago

Like this:

 Directory of C:\Users\James\code\Agents2Tasks\bin

2024-06-05  02:36 PM    <DIR>          .
2024-03-27  10:37 AM    <DIR>          ..
2023-10-29  09:29 AM                40 .gitkeep
2024-06-05  01:56 PM        15,022,921 Agents2Tasks.exe
               2 File(s)     15,022,961 bytes

 Directory of C:\Users\James\code\Agents2Tasks\dat

2024-06-05  01:56 PM    <DIR>          .
2024-03-27  10:37 AM    <DIR>          ..

2024-06-05  10:19 AM               444 ex34-3.txt
2024-06-03  03:37 PM               242 tid44.txt
              27 File(s)         33,180 bytes
rejkid-tester commented 5 months ago

Yep. I fixed that. Thank you. You have changed the output format from "A DATE A_group to Cleaner" to "A DATE A group assigned" - the underscore is missing, and that broke my code. Can you change "A group" to "A_group" please as the document specifies.

rejkid-tester commented 5 months ago

Thanks for fixing group name issue.

Now the problem is that the output for the following file: a2t_result.txt

should contain: ... A 202402100600 B_group assigned A 202402100600 ablack@gmail.com&07-06-1998 in B to Cleaner A 202402100600 rejkid@gmail.com&24-03-1961 in B to Cleaner A 202402100600 iwhite@gmail.com&02-07-1961 in B to Cleaner A 202402100600 awhite@gmail.com&07-06-1998 in B to Cleaner A 202402100600 iblack@gmail.com&02-07-1961 in B to Cleaner ...

In other words, for the B group records: A 202402100600 rejkid@gmail.com&24-03-1961 in B to Cleaner A 202402100600 iwhite@gmail.com&02-07-1961 in B to Cleaner A 202402100600 awhite@gmail.com&07-06-1998 in B to Cleaner A 202402100600 iblack@gmail.com&02-07-1961 in B to Cleaner

are missing. It was working prior to the fix for #44

JamesBremner commented 5 months ago

t 202402100600 Cleaner

This timeslot is specified with exactly one task. So it is assigned exactly one agent.

rejkid-tester commented 5 months ago

That's fair enough. There is though one little problem when the number of agents required is greater than the number of agents available in the group - like in the following file: a2t_result.txt

The last assignment in the "B_group assigned" is redundant and without "in B" in the "A 202402100600 ismith@gmail.com&02-07-1961 to Cleaner".

JamesBremner commented 5 months ago

The timeslot has 6 tasks.

The B group has five agents.

So another agent is assigned to the timeslot as an individual to complete the 6th task.

rejkid-tester commented 5 months ago

Hi James, This is inconsistent then. If I specify then two Cleaner tasks but I have three agents that can be Cleaners, I should get only two agents assigned as Cleaners - is that right? If you look in the following test file: a2t_result.txt Time slot '202402030600' requires two Cleaner agents only but it gets assigned three.

JamesBremner commented 5 months ago

Fixed.

rejkid-tester commented 5 months ago

Hi James, I am adding additional logic to my code as suggested by you. Just to clarify - by "most flexible agents in the group" you mean those agents that can do more tasks - is that right?

JamesBremner commented 5 months ago

Yes

rejkid-tester commented 5 months ago

Tested with the following data:

a ablack@gmail.com&07-06-1998 1 ablack@gmail.com Cleaner a awhite@gmail.com&07-06-1998 1 awhite@gmail.com Cleaner a iblack@gmail.com&02-07-1961 1 iblack@gmail.com Cleaner a ismith@gmail.com&02-07-1961 1 ismith@gmail.com Cleaner a iwhite@gmail.com&02-07-1961 1 iwhite@gmail.com Cleaner a rejkid@gmail.com&24-03-1961 1 rejkid@gmail.com Cleaner g A Cleaner ismith@gmail.com&02-07-1961 ablack@gmail.com&07-06-1998 rejkid@gmail.com&24-03-1961 g B Cleaner iblack@gmail.com&02-07-1961 iwhite@gmail.com&02-07-1961 awhite@gmail.com&07-06-1998 rejkid@gmail.com&24-03-1961 ablack@gmail.com&07-06-1998 t 202402030600 Acolyte Acolyte Acolyte Cleaner Cleaner Cleaner t 202402100600 Cleaner t 202404020600 Cleaner A 202402030600 A_group assigned A 202402030600 ismith@gmail.com&02-07-1961 in A to Cleaner A 202402030600 ablack@gmail.com&07-06-1998 in A to Cleaner A 202402030600 rejkid@gmail.com&24-03-1961 in A to Cleaner A 202402100600 B_group assigned A 202402100600 iblack@gmail.com&02-07-1961 in B to Cleaner A 202404020600 B_group assigned A 202404020600 iblack@gmail.com&02-07-1961 in B to Cleaner

Test has been successful. Closing the issue.

rejkid commented 5 months ago

Hi James, For some reason I can't change the state of the bug to fixed

JamesBremner commented 5 months ago

Closed == completed == fixed

image

rejkid commented 5 months ago

Thank you.