[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## [Help-glpk] Is there a way to express the array element operation based

**From**: |
Yuri |

**Subject**: |
[Help-glpk] Is there a way to express the array element operation based on index that is a variable? |

**Date**: |
Thu, 4 Apr 2019 16:28:19 -0700 |

**User-agent**: |
Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.6.0 |

Suppose I have these elements in the linear program:
param n := 10;
var idx, integer >= 1 <= n;
var arr{1..n};

`What would be the simplest way to express arr[idx] (for example to use
``arr]idx] in some other statements)?
`

`I know that this is possible. I first had "var memb{1..n}, binary;"
``instead of "idx", so that it expressed the array index as a boolean
``array instead of a single integer index, but this way it led to an
``unsolvable MIP instance.
`
Not even sure if this is a feasible way to simplify the MIP instance.
Thank you,
Yuri

[Prev in Thread] |
**Current Thread** |
[Next in Thread] |

**[Help-glpk] Is there a way to express the array element operation based on index that is a variable?**,
*Yuri* **<=**