help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] binary variables in CPLEX LP format


From: Oscar Herranz Sabaté
Subject: [Help-glpk] binary variables in CPLEX LP format
Date: Thu, 6 Oct 2005 18:51:47 +0200

Hi, i have a problem when execute this file

\* simplex_sistem.lp *\

Minimize
        Z:  0.486486486 Q1 + 0.642857143 Q2 + 0.947368421 Q3 + 0.782608696 Q4
+ 0.689189189 Q5 + 0.910714286 Q6 + 1.342105263 Q7 + 1.108695652 Q8 +
0.324324324 Q9 + 0.428571429 Q10 + 0.631578947 Q11 + 0.52173913 Q12 +
0.575675676 Q13 + 0.760714286 Q14 + 1.121052632 Q15 + 0.926086957 Q16

Subject To
        n1:     60 Q1 + 85 Q5 + 40 Q9 + 71 Q13 <= 123.333333333
        n2:     60 Q2 + 85 Q6 + 40 Q10 + 71 Q14 <= 93.333333333
        n3:     60 Q3 + 85 Q7 + 40 Q11 + 71 Q15 <= 63.333333333
        n4:     60 Q4 + 85 Q8 + 40 Q12 + 71 Q16 <= 76.666666667

        n5:     Q1 + Q2 + Q3 + Q4 = 1
        n6:     Q5 + Q6 + Q7 + Q8 = 1
        n7:     Q9 + Q10 + Q11 + Q12 = 1
        n8:     Q13 + Q14 + Q15 + Q16 = 1
Binary
        Q1
        Q2
        Q3
        Q4
        Q5
        Q6
        Q7
        Q8
        Q9
        Q10
        Q11
        Q12
        Q13
        Q14
        Q15
        Q16
End
\* eof *\


the problem is i need that the Qi variable is binary is to say that
their value is 0 or 1 and single that, not other.

It thought when define a binary variable this only take 0 or 1 value,
but some variables take 0.5 or 0.25 values.

Mi solution is:

        n5:     Q1 + Q2 + Q3 + Q4 = 1
        n6:     Q5 + Q6 + Q7 + Q8 = 1
        n7:     Q9 + Q10 + Q11 + Q12 = 1
        n8:     Q13 + Q14 + Q15 + Q16 = 1

but this is not feasible, i need for example if Q1=1 then Q2 and Q3
and Q4 =0, only one Qi of these four take 1 value also for Q5, Q6, Q7,
Q8 and following variables Qi.

PD: Sorry but my english is poor.

Thanks




reply via email to

[Prev in Thread] Current Thread [Next in Thread]