Genetic Algorithm for the Determination of Binodal Curves

download Genetic Algorithm for the Determination of Binodal Curves

of 13

Transcript of Genetic Algorithm for the Determination of Binodal Curves

  • 8/8/2019 Genetic Algorithm for the Determination of Binodal Curves

    1/13

    Genetic Algorithm for the Determination of BinodalCurves in Ternary Systems PolymerLiquid(1)Liquid(2)

    and Polymer(1)Polymer(2)Solvent

    G. MILANI,1 F. MILANI2

    1Department of Engineering, University of Ferrara, Via Saragat 1, 44100 Ferrara, Italy2CHEM.CO Consultant, Via J.F. Kennedy 2, 45030 Occhiobello, Rovigo, Italy

    Received 2 October 2006; Revised 1 February 2007; Accepted 23 February 2007

    DOI 10.1002/jcc.20735

    Published online 20 April 2007 in Wiley InterScience (www.interscience.wiley.com).

    Abstract: A simple genetic algorithm for the numerical evaluation of binodal curves in ternary systems polymerliquid (1)liquid (2) and polymer (1)polymer (2)solvent is presented. The technique exploits a specifically devel-

    oped restarting technique based on a combined elitist and zooming strategy on the last population at each iteration.The objective function (fitness) is represented by the weighted sum of the squared differences of chemical potentials

    of the two phases of each component, obtained evaluating first derivatives of Gibbs free energy of the mixture with

    respect to the number of moles of the components. The method proposed (a) is numerically stable since it does not

    require the evaluation of first derivatives of the objective function and (b) can be applied in a wide range of cases

    changing the equation of state. Several comparisons with simplified iterative procedures presented in the past in the

    technical literature both for mixtures of two polymers with identical characteristics in a solvent and for mixtures of

    solventnonsolventpolymer with solventpolymer interaction parameter equal to zero are reported. Finally, a com-

    parison between present results and the alternating tangent approach is reported for two technically meaningful

    binary systems, when a simplified PC-SAFT equation of state is adopted. The comparisons show that reliable results

    can be obtained by means of the algorithm proposed and suggest that the procedure presented can be used for practi-

    cal purposes.

    q 2007 Wiley Periodicals, Inc. J Comput Chem 28: 22032215, 2007

    Key words: genetic algorithms; ternary systems; phase diagrams; calculations; thermodynamics

    Introduction

    The numerical determination of binodal curves for a generic bi-

    nary polymerpolymer system and ternary polymerliquid (1)

    liquid (2) and polymer (1)polymer (2)solvent system is, at

    present, an issue that deserves consideration.

    In particular, some technical papers have been recently pre-

    sented in order to put at disposal to the practitioners both new

    analytical strategies (see refs. [1,2]) and refined numerical tools

    (see ref. [3]). The base is essentially an equation of state, that

    could be chosen, for instance, into the SAFT family,3 for a nu-

    merical evaluation of the liquidliquid phase equilibrium inpolymer systems. At a first attempt, with the sole aim of testing

    algorithms reliability, the FloryHuggins theory can be used for

    the evaluation of the Gibbs free energy,4 despite the fact that

    case studies presented in the technical literature (see, for

    instance, ref. [5]), showed that the validity of this approach can

    be limited and that FloryHuggins equation to liquid mixtures

    needs corrective parameters to fit well experimental data. In any

    case, a general algorithm (a) sufficiently robust and (b) fast and

    efficient for reproducing binodal curves in polymer mixtures

    seems still of interest, especially if the numerical tool is able to

    guarantee stability when input parameters and governing equa-

    tions are changed in a wide range.

    At this aim, in the present paper, a novel genetic algorithm

    based on a specifically developed restarting algorithm is pre-

    sented and applied for the evaluation of binodal curves for gen-

    eral ternary systems polymerliquid (1)liquid (2) and polymer

    (1)polymer (2)solvent.

    For the sake of simplicity, the approach presented assumes,

    for the first examples, the general expression of Gibbs free

    energy of a mixture derived from the well-known FloryHug-

    gins theory611; then, the procedure is applied to real mixtures

    making use of the simplified PC-SAFT equation of state.As a rule, differentiation of Gibbs free energy with respect to

    number of moles of the ith component gives the i correspondingchemical potential. Thus, binodal curves can be obtained imposing

    liquidliquid phase equilibrium at a specified temperature and pres-

    sure, i.e. equating chemical potentials of each component between

    two phases, say and . This yields to a nonlinear and, generally,nonconvex system of equations that should be solved resorting to

    Correspondence to: G. Milani; e-mail: [email protected]

    q 2007 Wiley Periodicals, Inc.

  • 8/8/2019 Genetic Algorithm for the Determination of Binodal Curves

    2/13

    numerical methods. It is worth underlining here that the algorithm

    proposed can be applied with any analytical expression of the Gibbs

    free energy and that the classical FloryHuggins theory is utilized

    here in the first examples only with the aim of comparing the results

    obtained with consolidated solutions from the literature. Other nu-

    merical approaches are, of course, at disposal to the practitioners;nevertheless, authors experienced that commercial packages based

    on NewtonRaphson schemes12,13: (a) depend on the particular

    choice of the Gibbs free energy, since information on derivatives is

    required; and (b) their convergence is strongly influenced by the

    starting point chosen at the first iteration. Furthermore, Newton

    Raphson algorithms require particular care in the multidimensional

    case and, for them, a strict monotony of the first partial derivatives

    is recommended in order to guarantee the unconditioned success

    of the method. Recent algorithms proposed, for instance, by

    von Solmes et al.3 are usually based on the so-called alternating tan-

    gent method, a modification of a well-known NewtonRaphson

    family procedure used in many technical applications. Contrary

    to the schemes based on first derivatives, the approach here

    proposed is intended to avoid typical NewtonRaphson numericalinstabilities and limitations, since, at least in principle, (a) the

    calculation of Gibbs free energy second derivatives is not

    needed (neither analytically or numerically), (b) the method does

    not require particular properties of smoothness of the objective func-

    tion, and (c) is particularly efficient and less time-consuming

    (because only a repeated evaluation of the objective function is per-

    formed).

    On the other hand, for simple cases in which, for instance,

    two components behave in the same way with respect to the

    third, robust iterative procedures or at hand simplified solutions

    in which only one unknown variable has to be determined have

    been at disposal for decades.1416 Nevertheless, the general prob-

    lem remains an open issue and algorithms at disposal are not

    able to guarantee convergence without limitations.In this framework, an approach based on genetic algorithms

    seems particularly attractive. Such schemes, in fact, are based

    solely on trivial algebraic operators (crossover and mutation)

    directly applied on random (sufficiently large) initial populations.

    Fitness function, i.e. the function to be minimized, is repre-

    sented by the weighted sum of the squared differences of chemi-

    cal potentials of phases of each component. Once that a concen-

    tration vi of one of the phases of one of the components in the

    ternary systems is fixed, e.g. v1, the minimization of the fitness

    function is guessed on a three variables domain, being v2, v01,

    and v02 the unknown concentrations.

    In general, genetic algorithms require a sufficiently large

    starting population to be reliable. Since for the present minimi-

    zation problem three unknown variables are involved (v2, v01, andv02), many points of evaluation of the objective function should

    be used. Obviously, from a computational point of view, this

    could represent a practical impossibility of application of the

    method or at least a strong limitation, especially if standard per-

    sonal computers nowadays at disposal are used.

    For this reason, a specifically developed algorithm (GAR_

    TER) which avoids this key drawback is here presented.

    GAR_TER works with small initial populations (from 100 to

    1000 points) and small total number of generations (from 60 to

    600). In order to handle efficiently small populations, a special

    feature consisting in a restarting technique is implemented.

    Such approach may be summarized in the following two steps.

    In step 1, a first trial optimization is performed and from the

    last generation the individual with the best fitness is selected

    (IB). In step 2, a new first generation is randomly reselected

    with new individuals collected in a zoomed domain fixed caseby case, but in which the individual IB selected from the previ-

    ous iteration is inserted. In this way, fitness of the best individ-

    ual in the first generation of iteration i is better (or at least

    equal) of that of the best individual of the last generation of iter-

    ation i 1. Since fitness function is zero in correspondence ofthe solution, step 2 is repeated until a fixed small tolerance (say

    TOL) is reached. Obviously, in each iteration, classic generation,

    mutation, and crossover operators are suitably introduced. Fur-

    thermore, step 2 combines an elitist strategy applied from itera-

    tion i 1 to iteration i and a zooming technique, which at eachiteration restricts the domain of random selection near the solu-

    tion found in correspondence of the previous iteration.

    As authors experienced, a reliable evaluation of the solution

    point for a given concentration of one phase of one of thecomponents is obtained with a very limited computational

    effort.

    In the following section, theoretical background of the prob-

    lem is briefly recalled, whereas in next section the genetic algo-

    rithm with restarting is presented in detail. In the Examples sec-

    tion, the numerical model is applied for several cases of techni-

    cal interest and compared with already presented solutions at

    disposal, in order to test its reliability. Finally, two real exam-

    ples of bicomponent systems are treated in A Real Case Binary

    Example section, making use of the simplified PC-SAFT method

    for the calculation of governing equations parameters.

    Theoretical Background

    FloryHuggins theory6 is the base to describe the phase behavior

    of a ternary system composed of liquid (1)liquid (2)polymer

    and polymer (1)polymer (2)solvent.

    For liquid (1)liquid (2)polymer systems, the Gibbs free

    energy of mixing Gm for the solution can be evaluated,

    according to ref. [17], as follows:

    Gm RTn1 ln1 n2 ln2 n3 ln3 12n12 13n13

    23n23 Tn123 1

    where R is a constant; T is the temperature; ni and i are numberof moles and volume fraction of component i, respectively (i 1:

    liquid; i 2: liquid; i 3: polymer); ij is a binary interactionparameter between component i and component j; T is a ternaryinteraction parameter introduced by some authors in order to fit

    better experimental data in ternary systems.17,18

    It is worth noting that Tompa14,16 (see also ref. [19]) calcu-

    lated binodal curves for the case of nonsolvent (liquid (1))sol-

    vent (liquid (2))polymer with T 23 12 13 by meansof a recursive algorithm based on at-hand calculations.

    Furthermore, Scott20 and Tompa16 were the first to apply

    FloryHuggins theory of polymer solutions to mixtures of poly-

    mers, with or without added solvent.

    2204 Milani and Milani Vol. 28, No. 13 Journal of Computational Chemistry

    Journal of Computational Chemistry DOI 10.1002/jcc

  • 8/8/2019 Genetic Algorithm for the Determination of Binodal Curves

    3/13

    In particular, Scott obtained the following expression for the

    Gibbs free energy of mixing of a total volume Vof two polymers:

    Gm RTV=VrA=xA lnA B=xB lnB ABAB (2)

    where Vr is a reference volume which is taken as close as possibleto the molar volume of the smallest polymer repeat unit; A andB are the volume fractions of polymer A and B respectively; xAand xB are the degrees of polymerization of polymer A and B

    respectively, in terms of the reference volume Vr; AB is the inter-action parameter between polymer A and B and is related to the

    enthalpy of interaction of the polymer repeat unit, each of molar

    volume Vr.

    In presence of a solvent, i.e. for polymer (1)polymer (2)

    solvent ternary systems, Scott20 derived from Eq. (2) the follow-

    ing expression for the Gibbs free energy of mixing:

    Gm RTV=Vss lns A=xA lnA B=xB lnB

    ABAB ASAS BSBS 3

    where index s refers to the solvent; Vs is the reference volume

    and equal to the molar volume of the solvent; AS and BS arethe interaction parameters between polymer A and B respec-

    tively, and the solvent.

    It is worth noting that xA, AB, AS, and BS must be consid-ered in terms of reference volume Vs.

    Scott calculated some binodals for special cases, as for instance,

    varying AB and assumingAS BS 0 with x xA xB.In the general case studied here, see ref. [6], binodal curves can

    be obtained evaluating chemical potentials of each component.

    Differentiation of Gibbs free energy given both by (1) and (3) with

    respect to number of moles of the ith component gives the corre-

    sponding i chemical potential. Then liquidliquid phase equilib-rium at a specified temperature and pressure is imposed, i.e. chemi-

    cal potentials of each component between two phases, say and ,are equated. This yields to recover point by point binodal curves,

    by means of nonlinear and, generally, nonconvex system of equa-

    tions that should be solved resorting to numerical methods. Denot-

    ing with v1, v2, v3 and v01, v

    02, v

    03 the concentrations of components

    1, 2, 3 in phase one and phase two respectively, such system of

    equations can be written as follows:

    where x1, x2, and x3 are the number of segments in component

    1, 2, and 3 respectively.

    It is stressed that Eq. (4) is obtained by taking as the general-

    ized expression for the entropy and for the heat of mixing in a

    polycomponent system the following expressions:

    Sm kP

    ni ln vi k n1 ln v1 P

    ni ln vi

    Hm zP

    xiniviwij

    Gm Hm TSm

    8>>>>>:

    5

    where Sm is the entropy of mixing calculated from external

    configurational considerations neglecting first neighbor interac-

    tions; Hm is the heat of mixing; z is the number of primary

    molecules combined in a given nonlinear molecule; k is the

    Bolzmanns constant; xi is the number of segments in a species

    i; ni is the number of polymer molecules of species i in a solu-

    tion; wij represents the interaction free energy change associ-

    ated with the formation of a contact between a pair of segmentsof molecules i and j.

    A geometrical representation of equilibrium of chemical

    potentials for a 2D problem in given in Figure 1, where the

    Gibbs free energy of a system in the bidimensional case is

    reported. Since chemical potentials are, by definition, the first

    derivatives of the Gibbs free energy with respect to the number

    of moles of the ith component, phases and can be evaluatedexploiting geometrical considerations, i.e. searching a line with

    double tangency with respect to Gm. Such procedure is com-

    monly referred to as common tangent algorithm.

    The Numerical Procedure:

    The GAR_TER Algorithm

    In this section, a genetic algorithm with restarting tool

    (GAR_TER) specifically developed for reproducing binodal

    curves of polymeric ternary systems is presented.

    It is stressed that the reproduction of binodal curves for ter-

    nary systems of polymers is, from a numerical point of view, a

    very difficult task, at least in the general case of application of

    the FloryHuggins theory. In fact, a system of nonlinear equa-

    tions should be managed and, due to the strong nonconvexity of

    the problem, the final success of the iterative procedure is not

    guaranteed if derivatives methods are applied, as already dis-

    cussed in ref. [12].

    For this reason, a genetic scheme is adopted in this paper, so

    avoiding procedures based on derivatives evaluation.In general, a Genetic Algorithm (GA) is a stochastic global

    search method that mimics the metaphor of natural biological

    evolution. At a first attempt, see ref. [21], GAR_TER classically

    operates on a population of potential solutions applying the prin-

    ciple of survival of the fittest to produce better and better

    approximations to a solution. At each generation, a new set of

    approximations is created by the process of selecting individuals

    according to their level of fitness in the problem domain and

    breeding them together using operators borrowed from natural

    genetics. This process leads to the evolution of populations of

    1 01 , F1 1

    01

    1 01 RT

    hln v1 1 v1 v2

    x1

    x2 v3

    x1

    x3 12v2 13v3

    v2 v3 23x1x2v2v3i

    2 02 , F2 2

    02

    2 02 RT

    hln v2 1 v2 v1

    x2

    x1 v3

    x2

    x3

    21v1 23v3 v1 v3 13x2

    x1v1v3

    i3

    03 , F3 3

    03

    3 03 RT

    hln v3 1 v3 v1

    x3

    x1 v2

    x3

    x2

    31v1 32v3 v1 v2 12x3

    x1v1v2

    i4

    2205Genetic Algorithm for the Determination of Binodal Curves in Ternary Systems

    Journal of Computational Chemistry DOI 10.1002/jcc

  • 8/8/2019 Genetic Algorithm for the Determination of Binodal Curves

    4/13

    individuals that are better suited to their environment than the

    individuals that they were created from.

    In particular, the kernel of the GA proposed is a set of

    genetic operations consisting of reproduction, crossover, and

    mutation. In GAR_TER individuals Pi v01i v2i v

    02i

    are encoded as chromosomes strings composed by means of a

    single-level binary string, so that the genotypes (chromosome

    values) are uniquely mapped onto the decision variable (pheno-

    typic) domain. The use of Gray coding is necessary to avoid a

    hidden representational bias in conventional binary representa-

    tion as the Hamming distance between adjacent values is con-

    stant.22

    In what follows, the characteristics of the GA algorithm pro-

    posed in this paper (GAR_TER) are described in detail. It is

    stressed that the kernel consists of an assemblage of both stand-ard operators (reproduction, crossing-over, and mutation) and

    nonstandard strategies (zooming and restarting). For what con-

    cerns standard operators, only a brief description of both the

    mathematical background and the parameters adopted is reported

    and the reader is referred to Goldberg21 for a detailed discussion

    and characterization of the basic aspects of the model.

    Finally, it is stressed that ad hoc nonstandard strategies

    (zooming and restarting) have been implemented in the code in

    order to obtain a considerable improvement of both robustness

    and stability (when applied to polymeric ternary systems) of

    classical and generalist GAs at disposal in commercial packages.

    Reproduction

    During the reproduction phase, for each individual a fitnessvalue derived from its raw performance measure given by the

    objective function is assigned. This value is used in the selection

    to bias towards more fit individuals. Highly fit individuals, rela-

    tively to the whole population, have a high probability of being

    selected for mating whereas less fit individuals have a corre-

    spondingly low probability of being selected.

    Once the individuals have been assigned a fitness value, they

    can be chosen from the population, with a probability according

    to their relative fitness, and recombined to produce the next

    generation.

    Several types of selection operators have been described in

    the literature, see Goldberg21 and Young-Doo Kwon et al.,23 for

    tournament selection and proportional selection.

    The present study uses a stochastic sampling with replace-

    ment (roulette wheel). An interval I is determined as the sum of

    the inverse of the fitness values fi of all the individuals in the

    current population, i.e. IP

    1=fi. For each individual i, a sub-interval Si corresponding to the inverse of its fitness value in the

    interval 0 I is determined, i.e. Si 1=fi, so that IP

    Siand the size of the interval associated to each individual is pro-

    portional to its fitness, i.e. so that a big subinterval corresponds

    to a highly fit individual. To select an individual, a random

    number is generated in the interval 0 I and the individualwhose segment subinterval spans the random number is selected,

    see Figure 2. This process is repeated until the desired numberof individuals has been selected.

    Furthermore, in the present paper, an elitist strategy is also

    applied, consisting in copying the strongest individual in the

    new generation.

    Crossover

    A crossover operator is used to exchange genetic information

    between pairs, or larger groups, of individuals.

    In the present study, we use a multipoint crossover operator,

    which works as follows: ki 1 2 c 1 crossoverpoints are randomly selected on two individuals (parents) repre-

    sented by c chromosomes (bits), as shown in Figure 3. Bits

    between the crossover points are exchanged between the parentsin order to produce two new offsprings.

    Figure 1. Determination of a binodal point in a 2D case (a) and corresponding ternary system (b).

    [Color figure can be viewed in the online issue, which is available at www.interscience.wiley.com.]

    Figure 2. Selection.

    2206 Milani and Milani Vol. 28, No. 13 Journal of Computational Chemistry

    Journal of Computational Chemistry DOI 10.1002/jcc

  • 8/8/2019 Genetic Algorithm for the Determination of Binodal Curves

    5/13

    Mutation

    Mutation is then applied to the new chromosomes, with a set

    probability P. Mutation causes the individual genetic representa-tion to be changed according to a probabilistic rule. In the bi-

    nary string representation, mutation causes a single bit to change

    its state, i.e. from 0 to 1 or from 1 to 0, see Figure 4.

    Mutation is generally considered to be a background operator

    that ensures that the probability of searching a particular sub-

    space of the problem space is never zero. In the present algo-

    rithm, mutation is applied with low probability fixed to 0.01.

    Individuals Fitness

    Objective function (i.e. individuals fitness) is chosen as a

    weighted sum of the squared differences of chemical potentials

    of the two phases of each component, see Eq. (4), as follows:

    Fitness fi X3i1

    1=x2i F2i 6

    Restarting Technique and Zooming Strategy

    Finally, an ad hoc restarting technique is necessary when at the

    end of the last generation, fitness value of the best individual is

    greater than a tolerance TOL sufficiently small and a priori fixed.

    Denoting for the problem at hand with v1 specific volume of

    component 1, phase 1 and assuming v1 known at each iteration

    step, v2, v01 and v

    02 are stochastic variables, defined in the first

    iteration in the range 0 1 and with inequality constraints0 v3 1 v1 v2 1, 0 v

    03 1 v

    01 v

    02 1. Further-

    more, it is assumed that each individual v2 v01 v02 is encodedusing a 64-bit binary string (chromosomal representation).

    The kernel of the procedure adopted is based on a combined

    elitist and zooming strategy, see also refs. [23,24] with fixed

    edge length 2TOL_z of the zooming cube. In fact, at each itera-

    tion, the new initial population is sampled randomly in the

    zooming cube, but preserving the best fitness individual of the

    previous iteration (elitist strategy). Form a practical point of

    view, this procedure consists simply in the random generation of

    a P matrix of the population with size nxm, where n is the total

    number of individuals and m is the encoding string length of the

    chromosomal representation of each individual, so that m

    depends both on the number of independent variables of the

    optimization problem and on the desired encoding length. Once

    that matrix P is at disposal, P is resized adding best fitness indi-

    vidual BiT

    F vector at the end of P P PT B

    iTF

    2. In this

    way, the elitist strategy preserves the best individual of the pre-vious iteration in the present iteration, whereas zooming tech-

    nique restricts search domain, so improving in any case conver-

    gence rate.

    Furthermore, at each iteration, the algorithm ensures that the

    population remains within the desired zoomed region during

    the GA dynamics by means of a so-called accept/refuse proce-

    dure, which consists in checking, for each individual Pi,

    whether Pi belongs to the zooming cube. If Pi does not belong

    to the zooming cube (this situation can occur only when muta-

    tion operator is applied, whereas crossing over always generates

    individuals belonging to the admissible region, being crossing

    over a linear operator), Pi is substituted by means of a random

    selection of a new individual.

    The details of the algorithm are summarized by means of thepseudocode reported in Table 1.

    It is stressed that such a zooming strategy consists, from a

    practical point of view, in limiting the so-called input random

    variability, i.e. the domain in which random population is gener-

    ated at each restarting step. In particular a square domain at

    each iteration (with adding limitations 0 vi 1, 0 v0i 1,Pvi

    Pv0i 1) is chosen only for the sake of simplicity,

    where the centroid of the domain is always represented by the

    coordinates of the best fitness individual of the previous iteration

    (elitist strategy).

    In this way, the best fitness individual of the first population in

    the (i + 1)th step presents a fitness value not grater to the fitness of

    the best fitness individual of the last population in the ith step.

    TOL_z restricts the random search at each restarting step ifollowing a forced behavior in the form TOL zi ^fi wherethe function ^f can be changed ad libitum by the operator

    depending on the problem to solve. Unfortunately, no theorems

    are available for assuring an unconditioned convergence of

    the method in any case, as well as no theoretical rules can be

    given in the choice of the ^f function. Even if this limitation

    could appear a rather important drawback of the method, it is

    always implicitly accepted that statistical/random optimization

    approaches (such as for instance a genetic algorithm) do not

    assure convergence at the desired solution without limitations.

    As a consequence, only experience in the numerical simulations

    of specific problems can help in the correct choice of input pa-

    rameters. In this framework, for the problem at hand, authors

    experienced a quite robust behavior of the algorithm when anexponential function for ^f is chosen, as shown in Figure 5.

    Figure 3. Multipoint crossover.

    Figure 4. Mutation.

    2207Genetic Algorithm for the Determination of Binodal Curves in Ternary Systems

    Journal of Computational Chemistry DOI 10.1002/jcc

  • 8/8/2019 Genetic Algorithm for the Determination of Binodal Curves

    6/13

    Finally, it is worth noting that the algorithm recalled in Table

    1 assures the success of the iterative procedure only when two

    corresponding phases, denoted with symbols vi and v0i, do not

    coincide. This condition corresponds to impose a further numeri-

    cal condition in the form vi v0i

    > TOL C 8i, with an a priorifixed value for the constant TOL_C.

    Examples

    In this section, four technically meaningful cases are treated in

    detail and binodal curves are reproduced by means of the algo-

    rithm proposed. A preliminary example is reported for a binary

    polymerpolymer mixture, in order to test the robustness of the

    algorithm using only one optimization variable. The results

    obtained are compared with numerical data collected by Tompa.16

    In the second example reported, the symmetrical case studied by

    Scott20 for a ternary system consisting of two equal polymers

    (polymer (1) and (2)) in a solvent is reported. Three different sub-

    cases are reproduced, varying 23 interaction parameter.In the third example, a comparison with Tompa16 for a

    ternary system of a polymer, a solvent and a nonsolvent is dis-cussed. Different subcases are reproduced, varying both x3 poly-

    merization degree and 13.Finally, in the last example, the basic equation of state is

    changed making use of the simplified PC-SAFT method and two

    technically meaningful subcases concerning binodal solutions pol-

    yisobutylenediisobutyl ketone and polystyrenemethyl cyclohex-

    ane are treated. Both binary liquidliquid equilibrium systems

    have been numerically reproduced by von Solmes et al.3 using an

    alternating tangent approach. Here, the GAR_ TER numerical

    results are compared with those presented in ref. [3]. The good

    agreement found suggests that the model can be used as a valuable

    alternative to more traditional NewtonRaphson schemes.

    Binary SolventPolymer Mixture

    In order to test the reliability of the numerical model proposed,

    let us consider the simple case of a two-component system con-

    sisting of a solvent v1 and a homogeneous polymer v2 character-ized by the parameter x, representing the ratio of the molar vol-

    umes of polymer and solvent. At a first attempt and for the sake

    of simplicity, we assume as governing equation (i.e. objective

    function) the FloryHuggins expression for the chemical poten-

    tials of the two components:

    Equating chemical potentials for the two coexisting phases for

    both components, we obtain after trivial algebra, an optimization

    problem in which, e.g. v2 is fixed and, at different values of ,

    v02 is the sole optimization variable. In this way, it is possible toplot binodals curves for the binary system in the v2 plane, asshown in Figure 6a, where a comparison between present results

    and Tompa data is reported varying the parameter x in a wide

    range. Finally in Figure 6b the best fitness value versus the gen-

    eration number for restarting step number 3 and x 100,v1 0:9 is reported. The very low value of the fitness at the endof the step shows the reliability of the solution reached.

    It is worth underling that, nowadays, this problem can be

    solved easily making use both of standard numerical tools based

    on NewtonRaphson algorithms and analytical simplified expres-

    Table 1. GAR_TER Pseudocode.

    Step 0: Fix a value for v1, TOL and TOL_z

    Step 1a: First iteration, solve the unconstrained optimization problem (6) using a genetic algorithm (*) with bounds 0 v2 1 v1, 0 v01 1,

    0 v02 1 and 0 1 v0

    1 v0

    2 1

    Step 1b: Select v2B v01B v

    02B defined as the best individual from the last generation of Step 1a

    Step 2:

    If fitness of the best individual v2B v01B v

    02B > TOL Then

    Step 2a: Solve problem (6) using a GA (*) within a zoomed interval Iz for the population centered in v2B v01B v

    02B, as follows:

    Pi v01v2v02 2 Iz

    Iz

    ^Pi v01v2 v

    02j

    v01B TOL z v01 v

    01B TOL z;

    v2B TOL z v2 v2B TOL z;v02B TOL z v

    02 v

    02B TOL z

    8>>>:

    9>>=>>; \

    ^P v01v2v02j

    0 i v01 1

    0 v2 1 v10 1 v2 v1 10 v02 10 1 v01 v

    02 1

    8>>>>>>>>>>>:

    9>>>>>>=>>>>>>;

    8>>>>>>>>>>>>>>>:

    Step 2a-1: Check, for each individual Pi in each population and after each GA operation (mutation, crossover) if Pi v01 v2 v02 2 Ic. If9ijPi=2Ic,

    generate randomly a new individual ePi for each ijPi=2 Ic, if necessary repeatedly, until all constraints are satisfied. In this way, an admissible individualePi 2 Ic is at disposal for index i. Delete the old inadmissible individual and insert the new admissible individual in position i.Step 2b: At the last population select the best individual v0

    1v2 v

    02 and put it in vector v2B v

    01B v

    02B

    Repeat Step 2

    End

    (*) Reproduction, Crossover, Mutation operators included

    01 ln v01 1 1=xv

    02 v

    022

    02 1=x ln v01 1 1=xv

    01 v

    021 7

    2208 Milani and Milani Vol. 28, No. 13 Journal of Computational Chemistry

    Journal of Computational Chemistry DOI 10.1002/jcc

  • 8/8/2019 Genetic Algorithm for the Determination of Binodal Curves

    7/13

    sions. Nevertheless, the example is numerically meaningful

    because (a) it allows us to test the reliability of the results

    obtained making use of the genetic algorithm proposed and (b)

    shows that the approach proposed does not depend on the ana-

    lytical expression chosen as state equation, since that it is

    required only the numerical value of the objective function in

    correspondence of an individual. At this aim, in A Real Case Bi-

    nary Example section the authors present also comparisons

    between the algorithm proposed and von Solms et al.3 Newton

    Raphson approach for real mixtures of technical interest (as for

    instance polystyrenemethyl cyclohexane for different molecular

    weights of polystyrene), when a simplified PC-SAFT equation of

    state is adopted instead of the simple FloryHuggins theory.

    Symmetrical Case, Polymer (1)Polymer

    (2)Solvent Solutions

    A symmetrical case for a ternary system of two polymers with

    identical characteristics in a solvent is discussed. Polymers are

    assumed with the following parameters: x2 x3 1000 and12 13 0. For the solvent we assume x1 1, whereas forthe polymers we assume three different interaction parameters

    23 equal to 4, 8, and 10 respectively.Scott solved this problem exploiting symmetry information

    and reducing the problem, for a given concentration v1, to a sim-

    ple non linear equation in one unknown, as shown in Figure 7.

    If a general approach is considered, a system of three nonlin-

    ear equations in three unknowns should be tackled.

    In Figure 8, a comparison between numerical results obtained

    with the algorithm proposed and Scott results is presented for

    the case 23 equal to 4.The same comparisons are reported in Figures 9 and 10 for

    23 8 and 23 20 respectively.In each optimization process, a population with 125 individu-

    als and a total number of generations equal to 70 were fixed.

    Figure 5. TOL zi TOL z0 ^fi function used in the simula-

    tion, where TOL z0 is the cube size in correspondence of thefirst iteration i.

    Figure 6. Binary solventpolymer system. (a) Binodal curves in the v2 plane at different valuesof the x parameter. (b) Logarithm of the best fitness versus generation for restarting number 3

    x 100, v01 0:9.

    2209Genetic Algorithm for the Determination of Binodal Curves in Ternary Systems

    Journal of Computational Chemistry DOI 10.1002/jcc

  • 8/8/2019 Genetic Algorithm for the Determination of Binodal Curves

    8/13

    Finally, in Figure 11 the best fitness value is plotted versus

    generation for a restarting iteration i equal to 6 and v1 0:2 forthe case 23 4. As it is possible to note, fitness value is veryclose to zero, meaning that the best individual is near the actual

    solution. Nevertheless, authors experienced that analytical results

    are reproduced with good accuracy enforcing for TOL a value

    less than or at least equal to 0.0001.

    Liquid (1)Liquid (2)Polymer Solutions

    The most commonly encountered ternary system containing poly-

    mers is that of two non polymeric liquids and a polymeric species.

    A simple case of a ternary system of nonsolvent NS or liquid

    1 L(1), solvent S, or liquid 2 L(2), and polymer P in which the

    interaction constants between one of the liquids and the polymer

    equals that between the two liquids 12 13 is here takeninto consideration. For this particular ternary system, an iterative

    procedure was proposed by Tompa16 in the special case of

    23 0 and x1 x2 1, which may be used as a comparison

    with the general algorithm here proposed and which can be sum-marized as follows:

    2v1 v01 ln

    v1

    v01

    1

    1

    x3

    v3 v

    03 12v

    21 v

    021

    2v1 v01 ln

    v1

    v01 ln

    v02v2

    2v1 v01 ln

    v1

    v01

    1

    x3ln

    v03v3

    8

    For an arbitrarily chosen v1 a trial value of v01 is assumed.

    From the first part of Eq. (8), one obtains v03 v3, from the thirdv03=v3, and hence v

    03 and v3. The condition

    Pvi 1 gives v02

    and v2. Their ratio can be compared with that calculated from

    the second of Eq. (8). The divergence is used as a guide for a

    better choice of v01.

    In Figure 12, a comparison between the iterative procedure

    proposed by Tompa and the present numerical simulations is

    shown assuming 12 13 0:9, 23 0, x1 x2 1, andx3 10.

    Figure 7. Geometrical procedure for the evaluation of binodal

    curves in the symmetrical case.

    Figure 8. Symmetrical case studied by Scott with 23 equal to 4,

    x2 x3 1000, x1 1, 12 13 0. Comparison betweennumerical results and solution proposed by Scott.

    Figure 9. Symmetrical case studied by Scott with 23 equal to 8,x2 x3 1000, x1 1, 12 13 0. Comparison betweennumerical results and solution proposed by Scott.

    2210 Milani and Milani Vol. 28, No. 13 Journal of Computational Chemistry

    Journal of Computational Chemistry DOI 10.1002/jcc

  • 8/8/2019 Genetic Algorithm for the Determination of Binodal Curves

    9/13

    Similarly, in Figures 13 and 14 the same comparisons are

    reported assuming 12 13 1 and 12 13 1:5 respec-tively.

    The comparisons show that the general procedure here

    adopted is able to reproduce with good accuracy previously pre-

    sented nongeneral procedures.

    In each optimization process, a population with 600 individu-

    als and a total number of generations equal to 100 were fixed.

    Finally, in Figure 15 a comparison with Tompa results is

    reported assuming 12 13 1:5 and x3 100. As it is possi-ble to note, in this case a not negligible error is present in the

    solution found with GAR_TER with respect to literature results.This is due to the value of the parameter x3, which strongly

    increases objective function flatness. Nevertheless, as shown in

    Figure 16, the error e % between GA results and analyticaldata, defined as e % max v1 v

    GA1

    ; v2 vGA2 ; v3 jvGA3 j= v1 v2 v3 where the superscript GA indicates con-centrations obtained with GAR_TER, does not exceed 4%, dem-

    onstrating that, from a technical point of view, numerical results

    are satisfactory.

    Finally it is stressed that, each point of the equilibrium

    curves reported required a processing time extremely low on a

    Pentium Intel 3 GHz PC equipped with 2 GB RAM, varying

    from 0.01 to 34 s assuming a final success tolerance TOL equal

    to 106.

    A Real Case Binary Example

    In this section, a comparison between the algorithm proposed

    and the alternating tangents approach proposed in refs. [3]

    (see also ref. [25]) and [26] is reported for the determination of

    binodal solutions system polyisobutylenediisopropyl ketone and

    polystyrenemethyl cyclohexane at different polymer molecular

    weights.

    Following the notation introduced in ref. [25], the governing

    equations for phase equilibrium can be formulated in a general

    Figure 10. Symmetrical case studied by Scott with 23 equal to 20,

    x2 x3 1000, x1 1, 12 13 0. Comparison between nu-merical results and solution proposed by Scott.

    Figure 11. Best fitness versus generation for restarting number 6 1 0:2, symmetric case 13 23equal to 4.

    2211Genetic Algorithm for the Determination of Binodal Curves in Ternary Systems

    Journal of Computational Chemistry DOI 10.1002/jcc

  • 8/8/2019 Genetic Algorithm for the Determination of Binodal Curves

    10/13

    way that applies to the evaluation of both binary and ternary liq-

    uidliquid equilibrium. Denoting with NC the total number of

    components, we assume as independent variables the logarithmic

    mole fractions in phases 1 and 2 and the logarithm of the K fac-

    tors, which are defined as:

    Ki vi

    v0i(9)

    These variables form the full set of independent variables for

    the ternary case, which gives us a total of nine (3NC) variables.

    For the binary case, the logarithm of the temperature is an addi-

    tional variable, that is, a total of seven (3NC + 1) variables are

    obtained.

    At equilibrium the fugacities of each component in the two

    phases are equal, i.e.

    vii v0i

    0i , Ki vi=v

    0i

    0i=i (10)

    where i

    and 0i

    are the fugacity coefficient in phase (1) and (2)

    respectively.

    Figure 12. Unsymmetrical case (Tompa) with 12 13 0:9,

    23 0, x1 x2 1, x3 10. Comparison between present nu-merical results and iterative algorithm proposed by Tompa.16

    Figure 13. Unsymmetrical case (Tompa) with 12 13 1,23 0, x1 x2 1, x3 10. Comparison between present nu-merical results and iterative algorithm proposed by Tompa.16

    Figure 14. Unsymmetrical case (Tompa) with 12 13 1:5,

    23 0, x1 x2 1, x3 10. Comparison between present nu-merical results and iterative algorithm proposed by Tompa.16

    Figure 15. Unsymmetrical case (Tompa) with 12 13 1:5,23 0, x1 x2 1, x3 100. Comparison between presentnumerical results and iterative algorithm proposed by Tompa.16

    2212 Milani and Milani Vol. 28, No. 13 Journal of Computational Chemistry

    Journal of Computational Chemistry DOI 10.1002/jcc

  • 8/8/2019 Genetic Algorithm for the Determination of Binodal Curves

    11/13

    Equation (10), together with the mass balances provides the

    following equations that have to be satisfied at equilibrium:

    lnKi ln0i lni 0 i 1; :::;NCX

    v0i 1Xvi 1

    (11)

    Obviously, one of the independent parameters have to be

    fixed in order to solve the set of Eq. (11). Lindvig et al.25 sug-

    gest to add a so-called specification equation in the formys S, where y is the vector collecting all the variables, s is theindex of the variable to be specified, that is, the position in the

    variable vector y, and S is a fixed input specified value (which

    is changed point by point when binodal curves have to be

    obtained).

    With this formulation, the total number of equations and var-

    iables is 7 for the binary case and 9 for the ternary case. As a

    rule, for binary systems with simplified PC-SAFT,11 can be sim-

    plified to a great extent and, as suggested in refs. [3,26] reduces

    to the well known following condition:

    f ln v1 ln 1 ln1 v1 ln 2 h

    ln v01 ln 01

    ln1 v01 ln 02

    i12

    where the objective function for the GA is represented by

    F f2 and other symbols have been already introduced.While composition derivatives of the fugacity coefficients are

    required using the method of alternating tangents, here only anumerical evaluation of fugacities (and not their derivatives with

    respect to compositions) is needed. Such numerical values are

    obtainable from the simplified PC-SAFT equation of state (see

    for further details Gross and Sadowski2729).

    In order to test the reliability of the numerical method pro-

    posed, two examples of technical interest are treated and a com-

    Figure 16. Error estimation between GA results and analytical results, Unsymmetrical case (Tompa)with 12 13 1:5, 23 0, x1 x2 1, x3 100.

    Figure 17. Comparison among experimental data, numerical com-

    mon tangent approach and GA approach for polyisobutylenediiso-

    propyl ketone systems. Experimental data are from Shultz and Flory.

    Lines are simplified PC-SAFT correlations with k12 0:0053, thesame at all three molecular weights.

    Figure 18. Comparison among experimental data, numerical com-

    mon tangent approach and GA approach for polystyrene (1)methyl

    cyclohexane (2) solutions. All systems are represented by the binary

    interaction parameters k12 0.0065.

    2213Genetic Algorithm for the Determination of Binodal Curves in Ternary Systems

    Journal of Computational Chemistry DOI 10.1002/jcc

  • 8/8/2019 Genetic Algorithm for the Determination of Binodal Curves

    12/13

    parison with previously presented numerical results by von Sol-

    mes et al.3 and Kouskoumvekaki26 are reported.

    In particular, Figure 17 shows a comparison among present

    numerical data, alternating tangent approach3 and experimental

    data for polyisobutylenediisopropyl ketone binary systems at

    different polymer molecular weights.PC-SAFT parameters were obtained following the procedure

    adopted in ref. [26] and the reader is referred to refs. [3,26] for

    further details. Experimental data are from Shultz and Flory.30 A

    single binary interaction parameter k12 was taken for all the sys-

    tems, as suggested in ref. [26].

    As it is possible to notice, the numerical procedure gives

    identical results with respect to the alternating tangent approach.

    Each point has been obtained by means of a numerical optimiza-

    tion which required in the most critical case less then 10 s.

    While a comparison with experimental evidences is not the

    objective of the paper, experimental values are reported for the

    sake of completeness. Here we only remark that the GA

    approach proposed seems particularly attractive with respect to

    the alternating tangent approach because is, in principle, moregeneralist and does not require analytical/numerical evaluation

    of derivatives.

    The same comparisons are reported in Figure 18 for the sys-

    tem polystyrenemethylcyclohexane for polystyrene molecular

    weights equal to 10,200, 46,400, and 719,000 in order of

    increasing critical solution temperature. In order to compare

    results with those obtained in refs. [3,26] all systems are repre-

    sented by the binary interaction parameters k12 0.0065,whereas experimental data are taken from Dobashi et al.31,32 As

    in the previous case, the agreement with von Solmes et al.3

    results is worth noting.

    Conclusions

    A genetic algorithm for the numerical evaluation of binodal

    curves in ternary systems liquid (1)liquid (2)polymer and

    polymer (1)polymer (2)solvent has been presented. The tech-

    nique exploits a specifically developed restarting technique

    based on a combined elitist and zooming strategy on the last

    population at each iteration. Objective function (fitness) is repre-

    sented by the weighted sum of the squared differences of chemi-

    cal potentials of the two phases of each component, obtained

    evaluating first derivatives of Gibbs free energy of the mixture

    with respect to the number of moles of the components. Equilib-

    rium conditions between two phases of the same component

    have been derived from the classical FloryHuggins theory

    (which implies only thermodynamic parameters) or making useof the simplified PC-SAFT method. The reliability of the

    approach adopted has been assessed through meaningful compar-

    isons with simple cases reported in the technical literature.

    Nomenclature

    fi fitness values of all the individuals in the current popula-tion, i.e. I

    P1=fi

    ^f TOL_z law of variation

    I numerical intervalm vectors/matrices dimensionn vectors/matrices dimensionni number of moles of component iP population matrix (size nxm)

    R constants index referred to the solventSi sub-intervalT temperatureTOL small numerical toleranceTOL C forced numerical condition on phase 1 and phase 2

    difference

    TOL_z 1/2 edge length of the zooming cubeVr reference volumeVs reference volume (equal to the molar volume of the solvent)

    x binary systems, ratio of the molar volumes of polymer andsolvent

    xA (xB) degrees of polymerization of polymer A (B) in termsof the reference volume Vr

    xi the number of segments in a species i;z number of primary molecules combined in a given non-lin-

    ear molecule

    Gm Gibbs free energyHm heat of mixingSm entropy of mixingi i

    th component chemical potential

    0i reference chemical potential of the ith component

    vi ith component concentration of phase 1

    v1, v2, v3 (v01, v

    02, v

    03) concentrations of components 1, 2, 3 in

    phase one (two)

    i volume fraction of component iA (B) volume fractions of polymer A (B)i fugacity coefficient in phase (1).

    0i fugacity coefficient in phase (2).T ternary interaction parameterij binary interaction parameter between component i and

    component j

    AB interaction parameter between polymer A and BAS (BS) interaction parameters between polymer A (B) and

    the solvent

    k Bolzmanns constantni number of polymer molecules of species i in a solutionwij interaction free energy change between a pair of seg-

    ments of molecules i and j

    References

    1. Sollich, P.; Warren, P. B.; Cates, M. E. Adv Chem Phys 2001, 116,

    265.

    2. Sollich, P. J Phys: Condens Matter 2002, 14, R79.

    3. von Solms, N.; Kouskoumvekaki, I. A.; Lindvig, T.; Michelsen, M.

    L.; Kontogeorgis, G. M. Fluid Phase Equilib 2004, 222/223, 87.

    4. Lindvig, T.; Michelsen, M. L.; Kontogeorgis, G. M. Fluid Phase

    Equilib 2002, 203, 247.

    5. Favre, E.; Nguyen, Q. T.; Clement, R.; Neel, J. Eur Polym J 1996,

    32, 303.

    6. Flory, P. J. Principles of Polymer Chemistry; Cornell University

    Press: Ithaca, NY, 1953.

    2214 Milani and Milani Vol. 28, No. 13 Journal of Computational Chemistry

    Journal of Computational Chemistry DOI 10.1002/jcc

  • 8/8/2019 Genetic Algorithm for the Determination of Binodal Curves

    13/13

    7. Flory, P. J. J Chem Phys 1941, 9, 660.

    8. Flory, P. J. J Chem Phys 1942, 10, 51.

    9. Huggins, M. L. J Chem Phys 1941, 9, 440.

    10. Huggins, M. L. Ann NY Acad Sci 1942, 43, 1.

    11. Huggins, M. L. J Am Chem Soc 1942, 64, 1712.

    12. Comincioli, V. Numerical Analysis, Methods Models and Applica-

    tions [in Italian]; Mc-Graw Hill: Milan, 1995.13. Emelianenko, M.; Liu, Z.-K.; Du, Q. Comput Mater Sci 2006, 35,

    61.

    14. Tompa, H. Trans Faraday Soc 1949, 45, 1142.

    15. Bramford, C. H.; Tompa, H. Trans Faraday Soc 1950, 46, 310.

    16. Tompa, H.Polymer Solutions; Butter Worths Scientific Publications:

    London, 1956.

    17. Young, T.-H.; Chuang, W.-Y. J Membr Sci 2002, 210, 349.

    18. Pouchley, J.; Zivny, A.; Solc, K. J Polym Sci 1968, C23, 245.

    19. Scott, R. L. J Chem Phys 1949, 17, 268.

    20. Scott, R. L. J Chem Phys 1949, 17, 279.

    21. Goldberg, D. E. Genetic Algorithms in Search, Optimization and

    Machine Learning; Addison-Wesley Publishing: Reading, MA, 1989.

    22. Holstien, R. B. Artificial genetic adaptation in computer control sys-

    tems, Ph.D. Thesis, Department of Computer and Communication

    Sciences, University of Michigan, Ann Arbor, 1971.

    23. Kwon, Y.-D.; Kwon, S.-B.; Jin, S.-B.; Kim, J.-Y. Comput Struct

    2003, 81, 1715.

    24. Lee, K. S.; Geem, Z. W. Comput Struct 2004, 82, 781.

    25. Lindvig, T.; Michelsen, M. L.; Kontogeorgis, G. M. Ind Eng ChemRes 2004, 43, 1125.

    26. Kouskoumvekaki, I. A. Modeling of phase equilibria for paint-

    related polymer systems, Ph.D. Thesis, Center for Phase Equilibria

    and Separation Processes (IVC-SEP), Department of Chemical Engi-

    neering, Technical University of Denmark, Lyngby, 2004.

    27. Gross, J.; Sadowski, G. Ind Eng Chem Res 2001, 40, 1244.

    28. Gross, J.; Sadowski, G. Ind Eng Chem Res 2002, 41, 1084.

    29. Gross, J.; Sadowski, G. Ind Eng Chem Res 2002, 41, 5510.

    30. Shultz, A. R.; Flory, P. J. J Am Chem Soc 1952, 74, 4760.

    31. Dobashi, T.; Nakata, M.; Kaneko, M. J Chem Phys 1980, 72,

    6685.

    32. Dobashi, T.; Nakata, M.; Kaneko, M. J Chem Phys 1980, 72, 6692.

    2215Genetic Algorithm for the Determination of Binodal Curves in Ternary Systems

    Journal of Computational Chemistry DOI 10.1002/jcc