[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Set pair e.g. ( (i, j) in T) not properly implemented in
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] Set pair e.g. ( (i, j) in T) not properly implemented in matrix generation (i.e. CPLEX LP formulation, etc.) in particular data set (e.g. repeating i's in (i, j) in T |
Date: |
Mon, 09 May 2016 16:55:52 +0300 |
Hi Noli,
> I have this constraint:
>
> set ADJACENT within {i1 in CROPTYPE, i2 in CROPTYPE: i1 <> i2};
>
> subject to Adjacent_Constraint{ t in PERIOD, (i1,i2) in ADJACENT, j in
> AGECLASS: isHarvestable[t,i1,j] and isHarvestable[t,i2,j] and (i1,i2)
> in ADJACENT }: Y[t,i1,j] + Y[t,i2,j] <= 1;
>
> And this is the data with the problem.
>
> set ADJACENT :=
> .
> .
> (21,33) <----
> .
> (33,1)
> (33,19)
> (33,20)
>
> (33,21) <----
>
> (33,22)
> (33,23)
> (33,26)
> (33,32)
> (33,34)
> .
> .
>
> The problem is, it is not generating the matrix or constraints after
> it encounters the data entry after (33,21).
>
> This is the result in CPLEX LP form conversion.
>
> Adjacent_Constraint(1,21,33,5): + Y(1,21,5) + Y(1,33,5) <= 1
>
> Adjacent_Constraint(1,32,72,6): + Y(1,32,6) + Y(1,72,6) <= 1
> Adjacent_Constraint(1,32,73,6): + Y(1,32,6) + Y(1,73,6) <= 1
>
> Adjacent_Constraint(1,33,21,5): + Y(1,21,5) + Y(1,33,5) <= 1
>
> Adjacent_Constraint(1,34,19,6): + Y(1,19,6) + Y(1,34,6) <= 1
> Adjacent_Constraint(1,34,20,6): + Y(1,20,6) + Y(1,34,6) <= 1
> Adjacent_Constraint(1,34,65,6): + Y(1,34,6) + Y(1,65,6) <= 1
>
> .
> .
> Adjacent_Constraint(2,19,34,7): + Y(2,19,7) + Y(2,34,7) <= 1
> Adjacent_Constraint(2,19,77,7): + Y(2,19,7) + Y(2,77,7) <= 1
> Adjacent_Constraint(2,19,81,7): + Y(2,19,7) + Y(2,81,7) <= 1
> Adjacent_Constraint(2,20,19,7): + Y(2,19,7) + Y(2,20,7) <= 1
> Adjacent_Constraint(2,20,34,7): + Y(2,20,7) + Y(2,34,7) <= 1
> Adjacent_Constraint(2,20,77,7): + Y(2,20,7) + Y(2,77,7) <= 1
>
> Adjacent_Constraint(2,21,33,6): + Y(2,21,6) + Y(2,33,6) <= 1
>
> Adjacent_Constraint(2,32,72,7): + Y(2,32,7) + Y(2,72,7) <= 1
> Adjacent_Constraint(2,32,73,7): + Y(2,32,7) + Y(2,73,7) <= 1
>
> Adjacent_Constraint(2,33,21,6): + Y(2,21,6) + Y(2,33,6) <= 1
>
> Adjacent_Constraint(2,34,19,7): + Y(2,19,7) + Y(2,34,7) <= 1
> Adjacent_Constraint(2,34,20,7): + Y(2,20,7) + Y(2,34,7) <= 1
> Adjacent_Constraint(2,34,65,7): + Y(2,34,7) + Y(2,65,7) <= 1
> Adjacent_Constraint(2,34,77,7): + Y(2,34,7) + Y(2,77,7) <= 1
> Adjacent_Constraint(2,35,38,7): + Y(2,35,7) + Y(2,38,7) <= 1
> Adjacent_Constraint(2,35,39,7): + Y(2,35,7) + Y(2,39,7) <= 1
> Adjacent_Constraint(2,35,41,7): + Y(2,35,7) + Y(2,41,7) <= 1
> Adjacent_Constraint(2,35,42,7): + Y(2,35,7) + Y(2,42,7) <= 1
> Adjacent_Constraint(2,36,37,8): + Y(2,36,8) + Y(2,37,8) <= 1
> .
> .
>
> I think this is a bug because all the (33, *) are not generated in the
> matrix formulation or constraints in CPLEX LP format.
I see nothing wrong. For example, there is
Adjacent_Constraint(1,34,19,6) generated for (34,19) in ADJACENT which
is listed below (33,21). For (33,22), (33,23), etc., corresponding
Adjacent_Constraints are not generated because the condition
isHarvestable[t,i1,j] and isHarvestable[t,i2,j] specified for
Adjacent_Constraint is not met.
> It is also a bit
> weird or written incorrect (i.e.
>
> Adjacent_Constraint(2,33,21,6): + Y(2,21,6) + Y(2,33,6) <= 1
>
> Instead of
>
> Adjacent_Constraint(2,33,21,6): + Y(2,33,6) + Y(2,21,6) <= 1
>
> Although it is the same mathematically.
This is okay. You should not expect the generated constraints and
variables to appear in the same order as in the model description.
>
> The ages of the Croptypes ( 22 iand 23 are 7 years old so it also
> avaiable to harvest).
>
> param Area:=
> .
> .
> 22 7 4.159
> 23 7 16.422
>
Please check your model more carefully. If you find a bug, please post a
model as small as possible that demonstrates only that bug. Thanks.
Andrew Makhorin
- Re: [Help-glpk] Set pair e.g. ( (i, j) in T) not properly implemented in matrix generation (i.e. CPLEX LP formulation, etc.) in particular data set (e.g. repeating i's in (i, j) in T,
Andrew Makhorin <=
- Re: [Help-glpk] Set pair e.g. ( (i, j) in T) not properly implemented in matrix generation (i.e. CPLEX LP formulation, etc.) in particular data set (e.g. repeating i's in (i, j) in T, Noli Sicad, 2016/05/09
- Re: [Help-glpk] Set pair e.g. ( (i, j) in T) not properly implemented in matrix generation (i.e. CPLEX LP formulation, etc.) in particular data set (e.g. repeating i's in (i, j) in T, Noli Sicad, 2016/05/09
- Re: [Help-glpk] Set pair e.g. ( (i, j) in T) not properly implemented in matrix generation (i.e. CPLEX LP formulation, etc.) in particular data set (e.g. repeating i's in (i, j) in T, Andrew Makhorin, 2016/05/09
- Re: [Help-glpk] Set pair e.g. ( (i, j) in T) not properly implemented in matrix generation (i.e. CPLEX LP formulation, etc.) in particular data set (e.g. repeating i's in (i, j) in T, Noli Sicad, 2016/05/09
- Re: [Help-glpk] Set pair e.g. ( (i, j) in T) not properly implemented in matrix generation (i.e. CPLEX LP formulation, etc.) in particular data set (e.g. repeating i's in (i, j) in T, Noli Sicad, 2016/05/09
- Re: [Help-glpk] Set pair e.g. ( (i, j) in T) not properly implemented in matrix generation (i.e. CPLEX LP formulation, etc.) in particular data set (e.g. repeating i's in (i, j) in T, Andrew Makhorin, 2016/05/10