[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Constraint Problem
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] Constraint Problem |
Date: |
Sun, 26 Aug 2007 13:18:26 +0400 |
> I need your help.when I write the constraint section of '.mod'
> file in GNU MathProg,I met a question.My problem is like this :
> set I;
> set J;
> set K;
> param interval,>0;
> param cap{i in I},integer>0;
> param efc{j in J,k in K}>0;
> var yesno{i in I,j in J,k in K},binary;
> var pnum{i in I,j in J,k in K},integer,>=0;
> s.t.xz2{i in I,j in J}:(sum{k in
> K}yesno[i,j,k]-1)*interval<=cap[i]*nl-sum {k in
> K}(efc[j,k]*pnum[i,j,k]);
> because I found that when sum{k in K} yesno[i,j,k] is not
> more than 1, I will get the wrong answer,I decide change this
> constraint to:
> s.t.xz2{i in I,j in J}:if sum{k in K}yesno[i,j,k]<=1 then 0
> else (sum{k in K}yesno[i,j,k]-1)*interval<=cap[i]*nl-sum {k in
> K}(efc[j,k]*pnum[i,j,k]);
> then the glpsol said"operand preceding<= has valid type","modal
> processing error".
> Can you help me solve this problem ?Thank you!
yesno[] is a variable, not a parameter, so you cannot use it in a
condition, because this leads to a non-linear constraint not allowed
in glpk. You need to reformulate that constraint.