help-glpk
[Top][All Lists]

## [Help-glpk] Constraint Problem

 From: gung_ Subject: [Help-glpk] Constraint Problem Date: Sun, 26 Aug 2007 13:04:59 +0400

```Everyone:

hi.
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!
charles
2007.8.26

Äã Íæ ¹ý Žó ž» ÎÌ Âð£¿³¬ ÈË Æø ÃÎ »Ã Î÷ ÓÎ °æ Žó ž» ÎÌ£¬µã »÷ Ãâ ·Ñ ÊÔ Íæ >> ```
Everyone:
hi.
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!
charles
2007.8.26

Äã Íæ ¹ý ´ó ¸» ÎÌ Âð£¿³¬ ÈË Æø ÃÎ »Ã Î÷ ÓÎ °æ ´ó ¸» ÎÌ£¬µã »÷ Ãâ ·Ñ ÊÔ Íæ >>