help-glpk
[Top][All Lists]
Advanced

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

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


From: hncp
Subject: Re: [Help-glpk] Error : multiplication of linear forms not allowed
Date: Sun, 4 Apr 2010 20:01:49 -0700 (PDT)

When I try to add this constraint as follows
s.t. cntr1{i in PROCESSES}: 0 <= p[i] + p[i+1] - 2*z[i] <= 1;
 I'm getting an error saying "p[6] out of domain
Model processing error"

In the data section PROCESSES are defined as
set PROCESSES := 1 2 3 4 5;

When specifying the constraint how can I set a p[i+1] a default value if i+1
is not in the domain?


Andrew Makhorin wrote:
> 
>> I'm trying to solve a subset selection problem using GLPK.
> 
>> I have n connected processes to be deployed in two machines. Each
>> process has different performance cost for each machine. Initially all
>> the processes are deployed in machine 1, I need to move subset of
>> these processes to machine 2 to minimize the total performance cost.
>> If two connected processes are deployed in different machines there is
>> transfer cost, this also should be taken into account when calculating
>> the total cost.
> 
>> Assume processes are connected in the order of P1, P2, ......., Pn . I
>> represented each process as a binary variable Pi, if the process i to
>> be moved machine 2, Pi = 1, else 0.
> 
>> So my objective function is minimize: sum {i in Processes} (M1i - (M1i
>> -M2i-Ti)* Pi) where M1i - cost of running ith process in machine 1 M2i
>> - cost of running ith process in machine 2 Ti - transfer cost between
>> ith process & (i+1)th process if they are in different machines
> 
>> If both Pi & Pi+1 are moved to machine 2 transfer cost between them
>> should be set to zero. My problem is how to specify this constraint in
>> GLPK ??
> 
>> I tried to do it as 
>> minimize: sum {i in Processes} (M1i - (M1i -M2i-(Pi+1)*Ti)*Pi) but it
>> gives me an error saying "multiplication of linear forms not allowed"
> 
>> Is there any other way to do this or is this problem cannot be solved
>> using GLPK?
> 
> You need to introduce auxiliary binary variables, say, z[i], where
> z[i] = P[i] * P[i+1]. Assuming that all P[i] are binary, this equality
> can be replaced by the following equivalent constraint:
> 
>    0 <= P[i] + P[i+1] - 2 * z[i] <= 1
> 
> that allows you avoiding multiplication.
> 
> 
> 
> _______________________________________________
> Help-glpk mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-glpk
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Error-%3A-multiplication-of-linear-forms-not-allowed-tp28111773p28136884.html
Sent from the Gnu - GLPK - Help mailing list archive at Nabble.com.





reply via email to

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