From c2e7d6507d9b04a0279813293a83d0c69d62957c Mon Sep 17 00:00:00 2001 From: Sin Yong Teng Date: Mon, 29 Apr 2019 12:52:19 +0200 Subject: [PATCH 01/16] Update README.md --- README.md | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 999f542..486c4b7 100644 --- a/README.md +++ b/README.md @@ -135,16 +135,45 @@ We can see that the algorithm quickly converges to the optimal point (see Fig. 5 For more examples refer to the python scripts in "examples" folder. [https://github.com/tsyet12/Duelist-Algorithm-Python/tree/master/examples] -# Small Tutorial on Complex Constraint using Karush-Kuhn-Tucker (KKT) conditions +# Dealing with Complex Constraint using Karush-Kuhn-Tucker (KKT) conditions There will be some problems that have complex constraints. For example, constraints which depends on two or more manipulated variables. -Say: we take the same problem from the **Short Tutorial**, and now we have an extra constraint, which is x1 must be larger than x2: +*Example 1: Inequality* + +Say: +We take the same problem from the **Short Tutorial**, and now we have an extra constraint, which is x1 must be larger than x2: + > x1>x2 Using KKT conditions, we can put this constraint in the objective function: -f=(x1,x2) = (x1)^2+(x2)^2 + ( +f=(x1,x2) = (x1)^2+(x2)^2 + max(0,x2-x1) + +Implementation: + +```python +def f(x1,x2): + return x1*x1+x2*x2+max(0,x2-x1) +``` +Continue from Step 2 of **Short Tutorial**. + + + +*Example 2: Equality* +Say: +We take the same problem from the **Short Tutorial**, and now the extra constraint is x1 equal to x2: + +f=(x1,x2) = (x1)^2+(x2)^2 + (x2-x1)^2 + +Implementation: + +```python +def f(x1,x2): + return x1*x1+x2*x2+(x2-x1)*(x2-x1) +``` + +Continue from Step 2 of **Short Tutorial**. # Version From f21946ab25270e88b437d5752a0d3df0d21a1cc2 Mon Sep 17 00:00:00 2001 From: Sin Yong Teng Date: Mon, 29 Apr 2019 13:06:48 +0200 Subject: [PATCH 02/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 486c4b7..79a4121 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Duelist-Algorithm-Python [![Build Status](https://travis-ci.com/tsyet12/Duelist-Algorithm-Python.svg?branch=master)](https://travis-ci.com/tsyet12/Duelist-Algorithm-Python) ![PyPI](https://img.shields.io/pypi/v/DuelistAlgorithmPython.svg) +# Duelist-Algorithm-Python [![Build Status](https://travis-ci.com/tsyet12/Duelist-Algorithm-Python.svg?branch=master)](https://travis-ci.com/tsyet12/Duelist-Algorithm-Python) ![PyPI](https://img.shields.io/pypi/v/DuelistAlgorithmPython.svg) (https://img.shields.io/badge/Python-3.4%20%7C%203.5%20%7C%203.6%20%7C%203.7-brightgreen.svg) A Python implementation of the paper : Duelist Algorithm: An Algorithm Inspired by How Duelist Improve Their Capabilities in a Duel (2015) Totok Ruki Biyanto, Henokh Yernias Fibrianto, Gunawan Nugroho, Erny Listijorini, Titik Budiati, Hairul Huda From 37568498cc1eedfda02a5b643c4f446ef3c6277a Mon Sep 17 00:00:00 2001 From: Sin Yong Teng Date: Mon, 29 Apr 2019 13:07:04 +0200 Subject: [PATCH 03/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 79a4121..62bf503 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Duelist-Algorithm-Python [![Build Status](https://travis-ci.com/tsyet12/Duelist-Algorithm-Python.svg?branch=master)](https://travis-ci.com/tsyet12/Duelist-Algorithm-Python) ![PyPI](https://img.shields.io/pypi/v/DuelistAlgorithmPython.svg) (https://img.shields.io/badge/Python-3.4%20%7C%203.5%20%7C%203.6%20%7C%203.7-brightgreen.svg) +# Duelist-Algorithm-Python [![Build Status](https://travis-ci.com/tsyet12/Duelist-Algorithm-Python.svg?branch=master)](https://travis-ci.com/tsyet12/Duelist-Algorithm-Python) ![PyPI](https://img.shields.io/pypi/v/DuelistAlgorithmPython.svg) [https://img.shields.io/badge/Python-3.4%20%7C%203.5%20%7C%203.6%20%7C%203.7-brightgreen.svg] A Python implementation of the paper : Duelist Algorithm: An Algorithm Inspired by How Duelist Improve Their Capabilities in a Duel (2015) Totok Ruki Biyanto, Henokh Yernias Fibrianto, Gunawan Nugroho, Erny Listijorini, Titik Budiati, Hairul Huda From a584b6acd600b14c4a27abcdf6aa3e301aef6979 Mon Sep 17 00:00:00 2001 From: Sin Yong Teng Date: Mon, 29 Apr 2019 13:07:56 +0200 Subject: [PATCH 04/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 62bf503..0694bda 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Duelist-Algorithm-Python [![Build Status](https://travis-ci.com/tsyet12/Duelist-Algorithm-Python.svg?branch=master)](https://travis-ci.com/tsyet12/Duelist-Algorithm-Python) ![PyPI](https://img.shields.io/pypi/v/DuelistAlgorithmPython.svg) [https://img.shields.io/badge/Python-3.4%20%7C%203.5%20%7C%203.6%20%7C%203.7-brightgreen.svg] +# Duelist-Algorithm-Python [![Build Status](https://travis-ci.com/tsyet12/Duelist-Algorithm-Python.svg?branch=master)](https://travis-ci.com/tsyet12/Duelist-Algorithm-Python) ![PyPI](https://img.shields.io/pypi/v/DuelistAlgorithmPython.svg) ![Python Version](https://img.shields.io/badge/Python-3.4%20%7C%203.5%20%7C%203.6%20%7C%203.7-brightgreen.svg) A Python implementation of the paper : Duelist Algorithm: An Algorithm Inspired by How Duelist Improve Their Capabilities in a Duel (2015) Totok Ruki Biyanto, Henokh Yernias Fibrianto, Gunawan Nugroho, Erny Listijorini, Titik Budiati, Hairul Huda From 8404e4e76d8e4f2d55306207d6ed3418156ef600 Mon Sep 17 00:00:00 2001 From: Sin Yong Teng Date: Mon, 29 Apr 2019 13:10:59 +0200 Subject: [PATCH 05/16] Update README.md --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index 0694bda..ee85d46 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,11 @@ $ pip install numpy # How to Use + +You can use two methods for installation: + +**1. From here (recommended as this will update faster)** + First download the git repository. You can do this by clicking the download button or using the git command: ```BASH $ git pull https://github.com/tsyet12/Duelist-Algorithm-Python @@ -64,6 +69,22 @@ Move to examples and run the examples $ cd examples ``` +**1. From pip ** +You can try installing this package from pip. + +Linux: + +```BASH +$ pip install DuelistAlgorithmPython +``` + +Windows: + +```BASH +$ python -m pip install DuelistAlgorithmPython +``` + + # Short Tutorial **There are four simple steps to run an optimization problem using Duelist Algorithm** From 9c5afc2ec8e34b23bbc8b0fb0e58546ae45b2526 Mon Sep 17 00:00:00 2001 From: Sin Yong Teng Date: Mon, 29 Apr 2019 13:28:24 +0200 Subject: [PATCH 06/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ee85d46..7521e95 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ This algorithm is fully implemented in Python. It is recommended to use Python 3 - numpy 1.15.4 ```BASH -$ pip install numpy +$ pip install numpy matplotlib ``` From 10880fb4acfd94e2d4dafbd5342e697bc3665367 Mon Sep 17 00:00:00 2001 From: Sin Yong Teng Date: Tue, 30 Apr 2019 10:09:38 +0200 Subject: [PATCH 07/16] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 7521e95..1417ad7 100644 --- a/README.md +++ b/README.md @@ -184,6 +184,9 @@ Continue from Step 2 of **Short Tutorial**. *Example 2: Equality* Say: We take the same problem from the **Short Tutorial**, and now the extra constraint is x1 equal to x2: +> x1=x2 + +Using KKT conditions, we can put this constraint in the objective function: f=(x1,x2) = (x1)^2+(x2)^2 + (x2-x1)^2 From 338b13e627e30f6784788af9357108be212cdd7f Mon Sep 17 00:00:00 2001 From: Sin Yong Teng Date: Tue, 30 Apr 2019 10:10:31 +0200 Subject: [PATCH 08/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1417ad7..7193ef5 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,7 @@ From the console we can deduce the optimal result (see Fig. 4) . The global opti ![result1](images/results.PNG) -*Fig 4. Optimal Results in Console* +*Fig 4. Optimal Results in Console (Colour may vary according to your environment)* We can see that the algorithm quickly converges to the optimal point (see Fig. 5) as reported by the original article. Note that graph is decreasing instead of increasing (in the case of original paper) because our objective is to MINIMIZE instead of maximizing. You can just add a negative sign in the function to get maximization. From a0b250028c28eeba0a406b8c275fce49013adf0a Mon Sep 17 00:00:00 2001 From: Sin Yong Teng Date: Tue, 30 Apr 2019 10:12:26 +0200 Subject: [PATCH 09/16] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7193ef5..21489e1 100644 --- a/README.md +++ b/README.md @@ -182,8 +182,10 @@ Continue from Step 2 of **Short Tutorial**. *Example 2: Equality* + Say: We take the same problem from the **Short Tutorial**, and now the extra constraint is x1 equal to x2: + > x1=x2 Using KKT conditions, we can put this constraint in the objective function: From a80dac0981d83a17fdf2ebf121c0435b069adf71 Mon Sep 17 00:00:00 2001 From: Sin Yong Teng Date: Mon, 13 May 2019 09:56:12 +0200 Subject: [PATCH 10/16] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 21489e1..63fc7d2 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ In the original paper, Duelist Algorithm was shown to out-perform a few state-of # Dependencies This algorithm is fully implemented in Python. It is recommended to use Python 3.X. Library dependencies: - numpy 1.15.4 +- matplotlib ```BASH $ pip install numpy matplotlib From 94889d06c34c9722aef9598b360c417a1724cebb Mon Sep 17 00:00:00 2001 From: Sin Yong Teng Date: Mon, 13 May 2019 10:06:48 +0200 Subject: [PATCH 11/16] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 63fc7d2..f930635 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ $ pip install numpy matplotlib You can use two methods for installation: -**1. From here (recommended as this will update faster)** +***1. Install from github (recommended as this will download the newest version)*** First download the git repository. You can do this by clicking the download button or using the git command: ```BASH @@ -70,7 +70,7 @@ Move to examples and run the examples $ cd examples ``` -**1. From pip ** +***1. Install from pip *** You can try installing this package from pip. Linux: From 12228e46ce1a14237c04ead9f69378baf00025ff Mon Sep 17 00:00:00 2001 From: Sin Yong Teng Date: Mon, 13 May 2019 10:07:52 +0200 Subject: [PATCH 12/16] Update README.md --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f930635..328dce2 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ $ pip install numpy matplotlib You can use two methods for installation: -***1. Install from github (recommended as this will download the newest version)*** +**1. Install from github (recommended as this will download the newest version)** First download the git repository. You can do this by clicking the download button or using the git command: ```BASH @@ -70,8 +70,9 @@ Move to examples and run the examples $ cd examples ``` -***1. Install from pip *** -You can try installing this package from pip. +**1. Install from pip ** + +You can install this package from pip. Linux: From 3119664061bac504e3b58b33eadf19ef02031a16 Mon Sep 17 00:00:00 2001 From: Sin Yong Teng Date: Thu, 16 May 2019 09:46:00 +0200 Subject: [PATCH 13/16] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 328dce2..bfd0dd5 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,11 @@ A Python implementation of the paper : Duelist Algorithm: An Algorithm Inspired by How Duelist Improve Their Capabilities in a Duel (2015) Totok Ruki Biyanto, Henokh Yernias Fibrianto, Gunawan Nugroho, Erny Listijorini, Titik Budiati, Hairul Huda https://arxiv.org/abs/1512.00708 + + + +This implementation only uses numpy, which is mainly written in C for fast computational speed. + I would like to clarify that various figures of this README.md document is taken from the original artical as shown above. From 69b1e16a578f4cbeb3b5deeec5e04434c6f95a52 Mon Sep 17 00:00:00 2001 From: Sin Yong Teng Date: Mon, 18 Jan 2021 16:09:52 +0100 Subject: [PATCH 14/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bfd0dd5..9e4ab3b 100644 --- a/README.md +++ b/README.md @@ -163,7 +163,7 @@ We can see that the algorithm quickly converges to the optimal point (see Fig. 5 For more examples refer to the python scripts in "examples" folder. [https://github.com/tsyet12/Duelist-Algorithm-Python/tree/master/examples] -# Dealing with Complex Constraint using Karush-Kuhn-Tucker (KKT) conditions +# Dealing with Complex Constraint conditions There will be some problems that have complex constraints. For example, constraints which depends on two or more manipulated variables. From ac716c05ed9dfa07ffe4388c1b9ec9f425422aa9 Mon Sep 17 00:00:00 2001 From: Sin Yong Teng Date: Mon, 18 Jan 2021 16:11:20 +0100 Subject: [PATCH 15/16] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9e4ab3b..1297373 100644 --- a/README.md +++ b/README.md @@ -174,7 +174,7 @@ We take the same problem from the **Short Tutorial**, and now we have an extra c > x1>x2 -Using KKT conditions, we can put this constraint in the objective function: +We can put this constraint in the objective function: f=(x1,x2) = (x1)^2+(x2)^2 + max(0,x2-x1) @@ -195,7 +195,7 @@ We take the same problem from the **Short Tutorial**, and now the extra constrai > x1=x2 -Using KKT conditions, we can put this constraint in the objective function: +We can put this constraint in the objective function: f=(x1,x2) = (x1)^2+(x2)^2 + (x2-x1)^2 From f32038a572472890f40159b170f8b48050bb349c Mon Sep 17 00:00:00 2001 From: Sin Yong Teng Date: Wed, 29 Jun 2022 12:32:30 +0200 Subject: [PATCH 16/16] Update requirements.txt --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 3e566f4..aa094d9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -numpy==1.15.4 -matplotlib \ No newline at end of file +numpy +matplotlib