|
From: | iimk |
Subject: | RE: [Help-glpk] information on presolve results |
Date: | Fri, 11 Jan 2008 17:28:45 -0800 |
Was solving a puzzle using glpk and wanted to model logical constraints.
Glpsol says : "Operand preceding = has invalid type"
Context: s.t. third : if truth[3]=1.......
Can't the if operator be used this way?
----------------------------------------
set N ;
var own {n in N}, binary;
var mentions{n in N},binary;
var truth{n in N}, binary;
maximize obj: mentions[1];
subject to first: truth[1]=own[3];
s.t. second: truth[2]=1-own[2];
s.t. third : if truth[3]=1 then sum{n in N}truth[n]=1;
s.t. CA:( if truth[3]=1 and mentions[1] then own[1] else(1- own[1]))=1;
s.t. CB:if (truth[3]=1 and mentions[2]) then own[2]=1 else(1- own[2])=1;
s.t. CC:if (truth[3]=1 and mentions[3]) then own[3]=1 else(1- own[3])=1;
s.t. owner:sum{n in N}own[n]=1;
s.t. cmentions: sum{n in N}mentions[n]=1;
data;
set N :=1 2 3;
end;
smime.p7s
Description: S/MIME cryptographic signature
[Prev in Thread] | Current Thread | [Next in Thread] |