|
From: | Chelaru, Laura |
Subject: | [Help-glpk] GLPK in R vs. AMPL |
Date: | Wed, 26 May 2010 01:06:54 +0400 |
Hi, I #8217;m running an LP through the R version of GLPK (http://cran.r-project.org/web/packages/glpk/index.html) and comparing the results with what I get out of AMPL (using the cplex solver, but that #8217;s probably not important). While in AMPL I get a reasonable answer so the model should be ok, in GLPK cannot find an optimal solution. I think it #8217;s to do with the absolute value constraints that I am using. I wanted to know if anyone else was having a similar issue, and how it was fixed. My .mod file is below: var yieldComp = sum{i in I}(x[i]*y[i]) + y_c*x_c; var krdMiss = -sum{m in M} v[m]; var sectExpMiss = -sum{s in S} w[s]; var sectMat = -sum{s in S} p[s]; maximize Opt_fun: yieldComp + krdMiss + sectExpMiss + sectMat; ##ABS VALUES KRDabs1 {m in M}: sum{i in I} x[i]*IM[i,m] - b[m] <= v[m]; KRDabs2 {m in M}: -(sum{i in I} x[i]*IM[i,m] - b[m]) <= v[m]; SECTabs1 {s in S}: sum{i in I} (x[i]*IS[i,s])-Ls[s] <= w[s]; SECTabs2 {s in S}: -(sum{i in I} (x[i]*IS[i,s])-Ls[s]) <= w[s]; SECTMATabs1 {s in S}: sum{i in I} (x[i]*z[i]*IS[i,s])-Lm <= p[s]; SECTMATabs2 {s in S}: -(sum{i in I} (x[i]*z[i]*IS[i,s])-Lm) <= p[s]; subject to krdConstr {m in M}: v[m] <= krdLim[m]; subject to SectExp {s in S}: w[s] <= Ls[s]; subject to SectMat {s in S}: p[s] <= Lm; subject to IndExp {i in I}: x[i] <= Li; subject to RatingExp {r in R}: sum{i in I} x[i]*IR[i,r] <= ratingLim[r]; subject to NonNeg {i in I}: x[i] >=0; subject to NonNegcash: x_c >= 0; subject to FullInv: sum{i in I} x[i] + x_c = 1; Thanks, Laura ********************* NOTICE OF CONFIDENTIALITY This communication including any information transmitted with it is intended only for the use of the addressees and is confidential. If you are not an intended recipient or responsible for delivering the message to an intended recipient, any review, disclosure, conversion to hard copy, dissemination, reproduction or other use of any part of this communication is strictly prohibited, as is the taking or omitting of any action in reliance upon this communication. If you receive this communication in error or without authorization please notify us immediately by return e-mail or otherwise and permanently delete the entire communication from any computer, disk drive, or other storage medium. If the above disclaimer is not properly readable, it can be found at www.td.com/legal AVERTISSEMENT DE CONFIDENTIALITE Ce courriel, ainsi que tout renseignement ci-inclus, destinй uniquement aux destinataires susmentionnйs, est confidentiel. Si vous n'кtes pas le destinataire prйvu ou un agent responsable de la livraison de ce courriel, tout examen, divulgation, copie, impression, reproduction, distribution, ou autre utilisation d'une partie de ce courriel est strictement interdit de mкme que toute intervention ou abstraction а cet йgard. Si vous avez reзu ce message par erreur ou sans autorisation, veuillez en aviser immйdiatement l'expйditeur par retour de courriel ou par un autre moyen et supprimer immйdiatement cette communication entiиre de tout systиme йlectronique. Si l'avis de non-responsabilitй ci-dessus n'est pas lisible, vous pouvez le consulter аwww.td.com/francais/legale
Hi, I’m running an LP through the R version of GLPK (http://cran.r-project.org/web/packages/glpk/index.html)
and comparing the results with what I get out of AMPL (using the cplex solver,
but that’s probably not important). While in AMPL I get a reasonable answer so the model should
be ok, in GLPK cannot find an optimal solution. I think it’s to do with the
absolute value constraints that I am using. I wanted to know if anyone else was
having a similar issue, and how it was fixed. My .mod file is below: var yieldComp = sum{i in I}(x[i]*y[i]) + y_c*x_c; var krdMiss = -sum{m in M} v[m]; var sectExpMiss = -sum{s in S} w[s]; var sectMat = -sum{s in S} p[s]; maximize Opt_fun: yieldComp + krdMiss + sectExpMiss + sectMat; ##ABS VALUES KRDabs1 {m in M}: sum{i in I} x[i]*IM[i,m] - b[m] <=
v[m]; KRDabs2 {m in M}: -(sum{i in I} x[i]*IM[i,m] - b[m]) <=
v[m]; SECTabs1 {s in S}: sum{i in I} (x[i]*IS[i,s])-Ls[s] <=
w[s]; SECTabs2 {s in S}: -(sum{i in I} (x[i]*IS[i,s])-Ls[s]) <=
w[s]; SECTMATabs1 {s in S}: sum{i in I} (x[i]*z[i]*IS[i,s])-Lm
<= p[s]; SECTMATabs2 {s in S}: -(sum{i in I} (x[i]*z[i]*IS[i,s])-Lm)
<= p[s]; subject to krdConstr {m in M}: v[m] <= krdLim[m]; subject to SectExp {s in S}: w[s] <= Ls[s]; subject to SectMat {s in S}: p[s] <= Lm; subject to IndExp {i in I}: x[i] <= Li; subject to RatingExp {r in R}: sum{i in I} x[i]*IR[i,r]
<= ratingLim[r]; subject to NonNeg {i in I}: x[i] >=0; subject to NonNegcash: x_c >= 0; subject to FullInv: sum{i in I} x[i] + x_c = 1; Thanks, Laura ********************* NOTICE OF CONFIDENTIALITY This communication including any information transmitted with it is intended only for the use of the addressees and is confidential. If you are not an intended recipient or responsible for delivering the message to an intended recipient, any review, disclosure, conversion to hard copy, dissemination, reproduction or other use of any part of this communication is strictly prohibited, as is the taking or omitting of any action in reliance upon this communication. If you receive this communication in error or without authorization please notify us immediately by return e-mail or otherwise and permanently delete the entire communication from any computer, disk drive, or other storage medium. If the above disclaimer is not properly readable, it can be found at www.td.com/legal AVERTISSEMENT DE CONFIDENTIALITE Ce courriel, ainsi que tout renseignement ci-inclus, destiné uniquement aux destinataires susmentionnés, est confidentiel. Si vous n'êtes pas le destinataire prévu ou un agent responsable de la livraison de ce courriel, tout examen, divulgation, copie, impression, reproduction, distribution, ou autre utilisation d'une partie de ce courriel est strictement interdit de même que toute intervention ou abstraction à cet égard. Si vous avez reçu ce message par erreur ou sans autorisation, veuillez en aviser immédiatement l'expéditeur par retour de courriel ou par un autre moyen et supprimer immédiatement cette communication entière de tout système électronique. Si l'avis de non-responsabilité ci-dessus n'est pas lisible, vous pouvez le consulter à www.td.com/francais/legale |
[Prev in Thread] | Current Thread | [Next in Thread] |