0% found this document useful (0 votes)
14 views6 pages

Astudyreportonsolving0 1knapsackwithimprecise

The document summarizes previous work on solving the knapsack problem with imprecise data and proposes a new approach. It discusses traditional knapsack problems and how previous work handled fuzzy data. The proposed approach uses a fuzzy model and genetic algorithm to solve knapsack problems with imprecise weights and profits.

Uploaded by

harshav1030
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views6 pages

Astudyreportonsolving0 1knapsackwithimprecise

The document summarizes previous work on solving the knapsack problem with imprecise data and proposes a new approach. It discusses traditional knapsack problems and how previous work handled fuzzy data. The proposed approach uses a fuzzy model and genetic algorithm to solve knapsack problems with imprecise weights and profits.

Uploaded by

harshav1030
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/321259550

A study report on solving 0–1 knapsack problem with imprecise data

Conference Paper · January 2017


DOI: 10.1109/ICCCI.2017.8117698

CITATIONS READS
2 6,693

2 authors, including:

Jayashree Padmanabhan
Anna University, Chennai
60 PUBLICATIONS 337 CITATIONS

SEE PROFILE

All content following this page was uploaded by Jayashree Padmanabhan on 04 March 2019.

The user has requested enhancement of the downloaded file.


2017 International Conference on Computer Communication and Informatics (ICCCI -2017), Jan. 05 – 07, 2017, Coimbatore, INDIA

A study Report on Solving 0-1 Knapsack Problem with


Imprecise Data
Jayashree Padmanabhan, Swagath S
Madras Institute of Technology, Anna University
Chennai , Tamil Nadu
[email protected]

Being NP-Hard, only pseudo polynomial algorithms like


Abstract—Knapsack problem has been widely studied due to its dynamic Programming algorithms are available. It can only be
broad applications in many fields of science. Dealing with imprecise applied to a small capacity or weight limit C. Some existing
data arises in many real world applications. A study report is approaches handled fuzzy data, to convert them to precise ones.
presented to comprehend the problem and its many variants for But extending the same by applying genetic algorithm will tend
suitable applicability. A revised method considering possibility and to scale up the capacity limit C that can be handled by the
necessity factors to work with imprecise data and to support
system.
different levels of optimization along with repetitiveness in solution
is proposed. A fuzzy model is proposed to deal with imprecise II. RELATED WORKS
parameters whose de-fuzzification gives a standard constraint
optimization problem which is solved using genetic algorithm. The A. Traditional knapsack
work proposes to extend the standard solution to find whether The traditional knapsack problem has finite set of items say
accepted level of profit can be achieved and for allowing multiple
S, whose cardinality is n, i.e., |S|=n, with every item in S having
instances of the same object in the solution. The results of genetic
optimization over two different solution paths are analyzed and
a weight w>0 and profit p>0 associated with it, and the task is to
better performance is achieved. compute the maximum profit that be achieved by choosing a
subset of items H where H⊆S such that the total weight of items
in H does not exceed C. This can be formulated as
Keywords—Combinatorial problem; Knapsack; optimization; Fuzzy;
Genetic algorithm

I. INTRODUCTION
One of the classic combinatorial optimization problems is the
knapsack problem which finds many applications in the
computing domain. From a given a set of items (each with a where xi=1, indicates the ith item is included in the solution.
weight and a value), the objective is to find number of items that
can be included so that the total weight is less than or equal to a In [1] the authors have proposed an effective method for
given limit and also the total value is maximum. The scalability solving small to medium sized knapsack problems using a
of knapsack problem is narrow, i.e., the existing dynamic modified discrete shuffled frog leaping algorithm to solve 0-1
programming solution cannot be scaled for high limit of the knapsack problems. They have used the local search of the
weights. Also the classical knapsack problem is the one which ‘particle swarm optimization’ technique and the competitiveness
handles crisp values of weights and profits. However there may mixing of information of the ‘shuffled complex evolution’
arise situations in real time where the profit and weight values technique for solving tightly constrained 0-1 knapsack problems.
may not be crisp and may be imprecise. Hence solving the A hybrid algorithm to solve the 0-1 Knapsack Problem using the
problem with these imprecise characteristics cannot be done by Genetic Algorithm combined with Rough Set Theory was
the classical dynamic programming solution. Thus in this work proposed in [2]. In [3] a modified scatter search methodology for
we propose a fuzzy model to deal with imprecise parameters different sizes of 0-1 Knapsack Problem (KP) was presented.
whose de-fuzzification gives a standard constraint problem Rough set theory was used to improve the initial features of
which is solved using genetic algorithm. scatter search. Rough Set Theory was adopted to reduce
attributes for finding the important genes, hence reducing the
A. Motivation search space. An artificial chemical reaction optimization
The main motivation is to extend the classical Knapsack to algorithm (ACROA) with a greedy strategy was proposed in [4]
real time situations like capital budgeting, network planning, etc. to solve 0-1 knapsack problem. ACROA was used to implement
where data is not so accurate. A classic example of such real the local and global search along with a greedy based solution
time situation is variable budgeting in a developing firm. repairing strategy. Cohort Intelligence, ability to learn from each
other was tested with Knapsack Problem for several cases of the
978-1-4673-8855-9/17/$31.00 ©2017 IEEE
2017 International Conference on Computer Communication and Informatics (ICCCI -2017), Jan. 05 – 07, 2017, Coimbatore, INDIA

0–1 KP [5] and the effect of various parameters on the solution


quality has been discussed. A binary particle swarm optimization
with a greedy strategy was devised in [6] to solve 0-1 knapsack
problem considering penalty function and greedy measure. In
[7] the authors presented Gravitational Search Algorithm (GSA)
with the cognitive component of finding the best position of the
particles and the particle with the best position in the system as
well in the neighborhood.
B. Knapsack with imprecise data This linear programming model when solved gives the
desired solution which has the following limitations. It cannot be
In areas where the knapsack takes in imprecise parameters as extended to higher weight limits and solving unbounded item
input, several fuzzy models have been proposed so far. One such knapsack is infeasible. (An item can be chosen more than
modeling is done in [8]. This work takes in the profit and weight once).A novel ant colony optimization algorithm was adopted in
as a range of values and are modeled using a trapezoidal [9] to solve binary knapsack problem. Fuzzy possibility and
function defined by (1). necessity approaches are used to obtain optimal decision by the
proposed ant colony algorithm.

For solving the multi objective 0–1 knapsack problem


quantum-inspired artificial immune algorithm for exploration of
the search space was presented in [10] and system was able to
find better spread of solutions and better convergence compared
to a quantum-inspired evolutionary algorithms. The
multidimensional knapsack problem has been solved using a
Boltzmann machine[11]. Alternative neural network approaches,
where x1<=x2 and a, b>0Here the fuzzy interval is denoted including a Hopfield network with asymmetric weights and the
by the quadruple (x1,x2,a,b). Dual-Mode Dynamics Neural Network, have been proposed to
handle inequality constraints, and tested using the knapsack
Consider a finite set of items A, where |A|=n. Let Pi (pi1, pi2, problem as detailed in [12].
ai, bi) be a trapezoidal fuzzy interval which models the imprecise
profit of the ith item and let Wi (wi1 ,wi2, ci, di ) be a trapezoidal III. PROPOSED WORK
fuzzy interval which models the imprecise weight of the ith item.
Let C be the crisp capacity of the knapsack and D denoting a The work on solving 0-1knapsack with imprecise weights
and profits includes the following steps:
given accepted level of profit. Let H⊆I be a given, nonempty
1) Model input data using trapezoidal functions
subset of items. Then W(H),the fuzzy weight of H and P(H), the
2) Formulate the problem using fuzzy model
fuzzy profit of H is given as:
3) Convert it to a linear programming problem formulation.
4) Apply Genetic algorithm techniques on the problem
formulated
5) The linear programming problem formulated above need
correction factor to converge at the right profit, so search
through the state space for the right point and perform
step 4 for each state.

The steps 1 and 2 are implemented using the models


By using the denotations in (2), the knapsack problem is proposed in [8]. The output from the step 2 is converted to a
formulated with possibility and necessity measures as in (3). linear programming problem by using Zadeh extension
principle. The workflow is depicted in Fig 1.

As discussed earlier, the given range of weight and profit


values are taken as trapezoidal functions shown in Fig 2 and as
so as to achieve the maximum possible profit without violating given in (1). Thus we have a set of trapezoids using which the
the capacity constraint. After this, the problem of knapsack is knapsack problem is formulated with the constraint that sum of
solved by converting to a mixed integer programming model and weights defined value to yield a minimum threshold profit as
is solved using linear programming techniques. The above in (3).
formulation is transformed to an integer programming model as
cited in (4):
2017 International Conference on Computer Communication and Informatics (ICCCI -2017), Jan. 05 – 07, 2017, Coimbatore, INDIA

by . Similarly the profit part of each cell is given


by .

The sum of profits of those items that are included in the


Imprecise data
Fuzzificatio Operations on solution A is defined as the fitness function as shown in (6).
input n(Model as Fuzzy Intervals
Trapezoidal (Zedah Extension
Functions) Principle)
Transformatio
n
(Integer
Programming
Model) Valid chromosomes are those whose weight is less than the
upper bound. Only valid chromosomes are selected for
crossover.
Selection,
Mutation and
Genetic
Algorithm
B. Population Selection
Cross over
operations
Representatio
n
Two trials with varying initial population, crossover and
selection operations are carried out and observed results are
recorded for comparative analysis.

Figure 1. System Workflow Diagram Method 1: The population size is set to twice the number of
genes in the chromosome. Each chromosome of the population
is first generated randomly. For each chromosome, its weight is
calculated using the following.

μX
where cell[i][[1] is the weight of the ith item given. The error is
calculated as,

a x1 x2 b where C is the capacity of the knapsack. The chromosome is


then made to converge to the nearest feasible solution (i.e) the
weight of the chromosome should be less than or equal to the
capacity C of the knapsack.
Figure 2. Trapezoidal representation of Input
Method 2: The initial population is taken as an identity
Equation (4) represents the linear programming problem of matrix of order equal to the size of the chromosome.
Knapsack. Here p and w represent fuzzy quantities with an error
factor say ‘t’. which replaces ‘λ’, (ie) λ=t/(powers of 10). Now C. Selection
the formulation becomes as in (5). The work adopts two different selection procedures as
described below for comparative analysis.

(5) Method 1: This work uses Roulette wheel selection,


according to which each chromosome is given a slice of a
circular roulette wheel equal in area to its fitness. The individual
chromosomes are mapped uniquely to a number between 0 and
and is solved applying Genetic algorithm. If t increases, the n. From 0 to n-1 a number is chosen randomly. This is same as
required objective function is maximized. But beyond a level T, rotating a wheel and selecting a roulette. Doing it N times lets
feasible solution cannot be obtained. Thus the goal is to find one choose n different samples of parent chromosomes for cross
maximum t that gives a feasible solution. It is shown that once over. The fitness of the chromosomes is not taken care of in this
for a given T feasible solution is not obtained for all t >T the method.
feasible solution cannot be obtained. Hence to find this t we can
use the bisection approach. Method 2: This work incorporated the selection algorithm
discussed in [13]. It combines the advantageous parts of roulette
A. Genetic Algorithm Representations wheel selection and rank selection i.e., exploitation and
Every item is represented using a pair of weight and profit exploration traits are combined here. This is a generation
values. A chromosome ‘A’ is defined as the array of size equal dependent selection algorithm, i.e., the initial generations have a
to the number of elements, where each element in the array is low selection pressure, hence the algorithm explores the search
either ‘0’ or ‘1’ corresponding to exclusion or inclusion of ith space, in contrast when the selection pressure is high in the later
item in the solution. Each cell has a weight part, which is given generations, that the algorithm exploits.
2017 International Conference on Computer Communication and Informatics (ICCCI -2017), Jan. 05 – 07, 2017, Coimbatore, INDIA

D. Crossover
Two crossover operations are utilized to generate better
offspring.

Method 1: Multi parent crossover[14] is used here. The


number of parents to be used is selected randomly (say n). Then
each parent is split into n sections. The offspring is constructed
by selecting the sections in the diagonal way respectively one
section from each parent.

Method 2: Single Point crossover is used here. It is defined


as swapping the segments of two different chromosomes
selected i.e., swapping the sub arrays between two
chromosomes. Here single point crossover is used. The
crossover point is determined randomly by generating a random
number between 0 and number of items- 1.
E. Mutation
Mutation is made to prevent genetic algorithms from falling
Figure 4. Trial 2 Plot for Best Fitness
into a local extreme. Mutation is performed here on each bit
position of the chromosome with 0.1 % probability.
IV. SIMULATION AND RESULT ANALYSIS It is inferred that method 1 converges faster than method 2
due to the abundant feasible population in the initial state while
Ga toolkit available in Global Optimization Toolbox in method 2 explores widely and so converges slowly. Considering
MATLAB was used for realizing the problem. The ga operators the trade off in time, method 2 on the other hand converges at
were customized for the problem. Given the input for the system global maximum.
as the range of values for weights and profits, the maximum
profit that is achievable without exceeding the capacity is V. CONCLUSION
computed and fitness plots for the two trials are plotted as shown
The work on revised knapsack with imprecise data adopted
in Fig.3 and Fig.4 respectively. Here the plots are in negative
fuzzy theory to deal with the imprecision in the input and genetic
axes values since Ga toolkit in MATLAB basically minimizes
algorithm to solve the transformed model of the base fuzzy
the objective function.
model. It is seen that using genetic algorithm shows better
performance for large inputs. This work can be further
incorporated with additional methods such as including the ‘t’
value as a gene in the chromosome itself rather than generating
population at each ‘t’ and mutation function can be modified
with the weighted probability based on their relative weight and
profit values.

REFERENCES
[1].Kaushik Kumar Bhattacharjee, and S.P.Sarmah,“Shuffled frog leaping
algorithm and its application to 0/1 knapsack problem,”APPL SOFT COMPUT,
vol. 19, pp. 252-263, June 2014.
[2].TribikramPradhani, AkashIsrani, and Manish Sharma,”Solving the 0-1
Knapsack Problem Using Genetic Algorithm and Rough Set Theory,”IEEE
Advanced Communication Control and Computing Technologies (ICACCCT),
2014 International Conference on, Department of Information and
Communication Technology (ICT), Manipal University, Karnataka, India, 2014.
[3]. Hassan Rezazade,”A Rough Sets based modified Scatter Search algorithm
for solving 0-1 Knapsack problem,” Decision Science Letters,vol 4, issue 3, pp.
425-440, 2015.
[4].Truong, Tung Khac, Li, KenliXu, Yuming, Ouyang, Aijia, Nguyen, and
TienTrong, "Solving 0 - 1 knapsack problem by artificial chemical reaction
optimization algorithm with a greedy strategy" in J INTELL FUZZY SYST, vol.
28, no. 5, pp. 2179-2186, 2015.
Figure 3. Trial 1 Plot for Best Fitness [5].Anand J. Kulkarni, and HinnaShabir, ”Solving 0–1 Knapsack Problem using
Cohort Intelligence Algorithm,”INT J MACH LECT CYBERN, vol. 7, Issue 3,
pp 427–441, 2016.
2017 International Conference on Computer Communication and Informatics (ICCCI -2017), Jan. 05 – 07, 2017, Coimbatore, INDIA

[6]. Phuong HoaiNguyena,b, Dong Wanga , and Tung Khac Truong, ”A New
Hybrid Particle Swarm Optimization and Greedy for 0-1 Knapsack Problem.
INDONES JELECTR ENG COMPUT SC, vol. 1, No. 3, pp 411 ∼ 418, 2016.
[7].Razavi, SeyedehFatemeh,Sajedi, and Hedieh,” Cognitive discrete
gravitational search algorithm for solving 0-1 knapsack problem,” in J INTELL
FUZZY SYST, vol. 29, no. 5, pp. 2247-2258, 2015.
[8].Adam H.Kasperski and Michal Kulej,”The 0-1 Knapsack problem with fuzzy
data,”FUZZY OPTIM DECIS MA, Springer, vol.6, Issue.2, pp.163-172,2007.
[9].C. Changdar , G.S. Mahapatra , and R.K. Pal,”An Ant colony optimization
approach for binary knapsack problem under fuzziness,”APPL
MATHCOMPUTAT, vol.223, pp.243–253, Oct 2013.
[10].JiaquanGao ,Guixia He, Ronghua Liang, and ZhilinFeng, ”A quantum-
inspired artificial immune system for the multiobjective 0–1 knapsack
problem,”APPL MATHCOMPUTAT, vol. 230, no.1, pp.120–137, mar 2014.
[11].Vaithyanathan, S., Ogmen, H., and Ignizio, J, ”Generalized Boltzmann
Machines for Multidimensional Knapsack Problems,” Intelligence Engineering
System through Artificial Neural Network,” vol.4, pp.1079-1084, 1994.
[12]. Lust T, and TeghemJ,”The multi-objective multidimensional knapsack
problem: A survey and a new approach,” INTTRANS OPER RES,vol. 19, no.4,
pp.495-520, 2012.
[13]. Rakesh Kumar and Jyotishree, ”Blending Roulette Wheel Selection and
Rank Selection in Genetic Algorithms,”INT J MACH LECT COMP,vol 2, No. 4,
pp. 365-370,2012.
[14].Yang Wang, Zhipeng Lu and Jin-Kao Hao, ”A study of Multi-parent
Crossover Operators in a Memetic Algorithm,”11thLECT NOTES COMPUT
SC,Springer, pp.556-565, 2010.

View publication stats

You might also like