help-glpk
[Top][All Lists]

## Re: [Help-glpk] "multiplication of linear forms not allowed"

 From: Michael Hennebry Subject: Re: [Help-glpk] "multiplication of linear forms not allowed" Date: Mon, 22 Oct 2012 16:53:53 -0500 (CDT) User-agent: Alpine 1.00 (DEB 882 2007-12-20)

```On Sun, 21 Oct 2012, Meketon, Marc wrote:

```
```-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of Reginald Beardsley
Sent: Sunday, October 21, 2012 10:46 AM
To: glpk
Subject: [Help-glpk] "multiplication of linear forms not allowed"
```
```
```
```I'm trying to apply the following constraint following a suggestion by xypron:
```
```
```
```var M{J} ,binary;

var B{J,K} ,>= 0;
```
```
```
```s.t. a{j}: -M[j]*sum{k in  K}B[j,k] <= A[j] <= M[j]*sum{k in K}B[j,k];
```
```
```
```The goal being to force A[j] = 0 if the sum over k of B[j,k] = 0;
```
```
If B is continuous, I suspect that it cannot be done.
If B is integer:

var s{J} ,binary;
var B{J,K} ,>=0;
param M{J} ;  upper bound on sum{k in K}B[j,k]
param L{j} ;  lower bound on A[j]
param U{j} ;  upper bound on A[j]

s.t. a{j in J}: s[j] <= sum{k in K}B[j,k] <= M[j]*s[j];
s.t. b{j in J}: L[j]*s[j] <= A[j] <= U[j]*s[j]

--