> I'm trying to solve a LP problem. > > Maximize y > > subject to > constraint 1 : 0.25(x1) + 0.16(x2) + 0.71(x3) + 0.15(x4) + 0.28(x5) > + 0.6(x6) + 0.27(x7) + 0.79(x8) + 0.19(x9) + 0.53(x10)=y > constraint 2 : 0.65(x1) + 0.6(x2) + 0.7(x3) + 0.1(x4) + 0.2(x5) + > 0.63(x6) + 0.26(x7) + 0.71(x8) + 0.12(x9) + 0.23(x10)=y > constraint 3 : x1 + x2 + x3 + x4 + x5 = 2 > constraint 4 : x6 + x7 + x8 + x9 + x10 = 3 > constraint 5 : x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10= 5 > > I couldn't figure out how to give a objective function of this type. > The Xi variables are given as integer variables with their upper and > lower bound as 0 and 1 so that they act as binary variables and i > don't know how to give a objective function of this type. >
You may write your model in the GNU MathProg modeling language (subset of AMPL) or in CPLEX LP format, and then solve it with glpsol. In MathProg binary variables are declared as follows: var x1, binary; var x2, binary; etc. For more details see the language reference and numerous examples included in the glpk distribution. The following tutorial can also help you: http://www-128.ibm.com/developerworks/linux/library/l-glpk1/ http://www-128.ibm.com/developerworks/linux/library/l-glpk2/ http://www-128.ibm.com/developerworks/linux/library/l-glpk3/ Note that due to binary variables your model is of mip class rather than lp. _______________________________________________ Help-glpk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-glpk
