Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; plgContentJComments has a deprecated constructor in /var/www/astarmathsandphysics/plugins/content/jcomments/jcomments.php on line 25 Call Stack: 0.0000 360976 1. {main}() /var/www/astarmathsandphysics/index.php:0 0.0668 1209816 2. Joomla\CMS\Application\SiteApplication->execute() /var/www/astarmathsandphysics/index.php:49 0.0668 1209816 3. Joomla\CMS\Application\SiteApplication->doExecute() /var/www/astarmathsandphysics/libraries/src/Application/CMSApplication.php:267 0.2339 4037352 4. Joomla\CMS\Application\SiteApplication->dispatch() /var/www/astarmathsandphysics/libraries/src/Application/SiteApplication.php:233 0.2355 4065064 5. Joomla\CMS\Component\ComponentHelper::renderComponent() /var/www/astarmathsandphysics/libraries/src/Application/SiteApplication.php:194 0.2364 4082776 6. Joomla\CMS\Component\ComponentHelper::executeComponent() /var/www/astarmathsandphysics/libraries/src/Component/ComponentHelper.php:356 0.2364 4099784 7. require_once('/var/www/astarmathsandphysics/components/com_content/content.php') /var/www/astarmathsandphysics/libraries/src/Component/ComponentHelper.php:381 0.2373 4107520 8. ContentController->execute() /var/www/astarmathsandphysics/components/com_content/content.php:42 0.2373 4107520 9. ContentController->display() /var/www/astarmathsandphysics/libraries/src/MVC/Controller/BaseController.php:710 0.3091 4351656 10. ContentController->display() /var/www/astarmathsandphysics/components/com_content/controller.php:113 0.3106 4369056 11. Joomla\CMS\Cache\Controller\ViewController->get() /var/www/astarmathsandphysics/libraries/src/MVC/Controller/BaseController.php:663 0.3112 4389984 12. ContentViewArticle->display() /var/www/astarmathsandphysics/libraries/src/Cache/Controller/ViewController.php:102 0.3209 4462560 13. Joomla\CMS\Plugin\PluginHelper::importPlugin() /var/www/astarmathsandphysics/components/com_content/views/article/view.html.php:189 0.3210 4462816 14. Joomla\CMS\Plugin\PluginHelper::import() /var/www/astarmathsandphysics/libraries/src/Plugin/PluginHelper.php:182 Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; JCommentsACL has a deprecated constructor in /var/www/astarmathsandphysics/components/com_jcomments/classes/acl.php on line 17 Call Stack: 0.0000 360976 1. {main}() /var/www/astarmathsandphysics/index.php:0 0.0668 1209816 2. Joomla\CMS\Application\SiteApplication->execute() /var/www/astarmathsandphysics/index.php:49 0.0668 1209816 3. Joomla\CMS\Application\SiteApplication->doExecute() /var/www/astarmathsandphysics/libraries/src/Application/CMSApplication.php:267 0.2339 4037352 4. Joomla\CMS\Application\SiteApplication->dispatch() /var/www/astarmathsandphysics/libraries/src/Application/SiteApplication.php:233 0.2355 4065064 5. Joomla\CMS\Component\ComponentHelper::renderComponent() /var/www/astarmathsandphysics/libraries/src/Application/SiteApplication.php:194 0.2364 4082776 6. Joomla\CMS\Component\ComponentHelper::executeComponent() /var/www/astarmathsandphysics/libraries/src/Component/ComponentHelper.php:356 0.2364 4099784 7. require_once('/var/www/astarmathsandphysics/components/com_content/content.php') /var/www/astarmathsandphysics/libraries/src/Component/ComponentHelper.php:381 0.2373 4107520 8. ContentController->execute() /var/www/astarmathsandphysics/components/com_content/content.php:42 0.2373 4107520 9. ContentController->display() /var/www/astarmathsandphysics/libraries/src/MVC/Controller/BaseController.php:710 0.3091 4351656 10. ContentController->display() /var/www/astarmathsandphysics/components/com_content/controller.php:113 0.3106 4369056 11. Joomla\CMS\Cache\Controller\ViewController->get() /var/www/astarmathsandphysics/libraries/src/MVC/Controller/BaseController.php:663 0.3112 4389984 12. ContentViewArticle->display() /var/www/astarmathsandphysics/libraries/src/Cache/Controller/ViewController.php:102 0.5813 12257848 13. JEventDispatcher->trigger() /var/www/astarmathsandphysics/components/com_content/views/article/view.html.php:199 0.5815 12258296 14. plgContentJComments->update() /var/www/astarmathsandphysics/libraries/joomla/event/dispatcher.php:160 0.5815 12258296 15. plgContentJComments->onContentAfterDisplay() /var/www/astarmathsandphysics/libraries/joomla/event/event.php:70 0.5817 12266544 16. plgContentJComments->onAfterDisplayContent() /var/www/astarmathsandphysics/plugins/content/jcomments/jcomments.php:339 0.5820 12268280 17. JComments::show() /var/www/astarmathsandphysics/plugins/content/jcomments/jcomments.php:282 0.5826 12301328 18. JCommentsFactory::getACL() /var/www/astarmathsandphysics/components/com_jcomments/jcomments.php:188 0.5826 12301728 19. spl_autoload_call() /var/www/astarmathsandphysics/components/com_jcomments/classes/factory.php:274 0.5827 12301808 20. JLoader::load() /var/www/astarmathsandphysics/components/com_jcomments/classes/factory.php:274

Using the Hungarian Algorithm to Find an Allocation That Maximises Profit

The Hungarian Algorithm is used to find an allocation to minimise cost, but can be adapted to find an allocation that maximises profit. This is done by making each entry in the profit matrix negative and and a fixed number to each element in the resulting table to make it non – zero.

The following table shows the profit made by each worker doing one of four tasks.

 

Task 1

Task 2

Task 3

Task 4

Worker A

3

6

1

7

Worker B

9

8

4

12

Worker C

1

4

2

10

Worker D

16

12

7

4

Making each entry negative gives the matrix:

 

Task 1

Task 2

Task 3

Task 4

Worker A

-3

-6

-1

-7

Worker B

-9

-8

-4

-12

Worker C

-1

-4

-2

-10

Worker D

-16

-12

-7

-4

The most negative entry is now -16, so add 16 to each entry to give the matrix below.

 

Task 1

Task 2

Task 3

Task 4

Worker A

13

10

15

9

Worker B

7

8

12

4

Worker C

15

12

14

6

Worker D

0

4

9

12

Subtract the smallest entry in each row from every element in that row to give the matrix below.

 

Task 1

Task 2

Task 3

Task 4

Worker A

4

1

6

0

Worker B

3

5

8

0

Worker C

9

6

8

0

Worker D

0

4

9

12

Subtracting the smallest element in each column from every entry in that column gives the matrix below.

 

Task 1

Task 2

Task 3

Task 4

Worker A

4

0

0

0

Worker B

3

4

2

0

Worker C

9

5

2

0

Worker D

0

3

3

12

Three lines are needed to cover all the zeros.

 

Task 1

Task 2

Task 3

Task 4

Worker A

4

0

0

0

Worker B

3

4

2

0

Worker C

9

5

2

0

Worker D

0

3

3

12

The smallest uncovered element is 2. Add 2 to each element covered by a line, and 4 to each element covered covered twice.

 

Task 1

Task 2

Task 3

Task 4

Worker A

6

2

2

4

Worker B

3

4

2

2

Worker C

9

5

2

2

Worker D

2

5

5

16

Now subtract 2 from each element, giving the matrix below. Four lines are required to cover all the zeros.

 

Task 1

Task 2

Task 3

Task 4

Worker A

4

0

0

2

Worker B

3

4

0

0

Worker C

9

5

0

0

Worker D

0

3

3

14

The allocation is:

Worker A does task 2, worker B does task 3, worker C does task 3 and worker D does task 1. The total profit produced is found by referring to the original matrix. It is 6+4+10+16=36.

Add comment

Security code
Refresh