Hi, I'm trying to solve a multi-objective LP. I have a scenario with 2 power suppliers and 3 consumers. The suppliers sell power to each consumer. I'm trying to maximize each suppliers profit individually and minimize each consumers cost individually. Therefore I would have 5 objective functions. I also have 5 constraints: 3 for demand and 2 for supply. Here's what I have so far: Data file: set Consumers:= C1 C2 C3; set Suppliers:= S1 S2; param bids:= C1 4 C2 7.5 C3 6; param offers:= S1 5 S2 3; param supply:= S1 30 S2 20; param demand:= C1 10 C2 25 C3 15; Model file: set Consumers; set Suppliers; param bids{j in Consumers}; param offers{i in Suppliers}; param supply{i in Suppliers}; param demand{j in Consumers}; var P{i in Suppliers, j in Consumers}>=0; maximize profit1{i in Suppliers: i=1}:sum{j in Consumers} bids[j]*P[1,j]; maximize profit2{i in Suppliers: i=2}: sum{j in Consumers} bids[j]*P[i,j]; minimize cost1{j in Consumers:j=1}:sum{i in Suppliers}offers[i]*P[i,j]; minimize cost2{j in Consumers:j=2}: sum{i in Suppliers} offers[i]*P[i,j]; minimize cost3{j in Consumers:j=3}: sum{i in Suppliers} offers[i]*P[i,j]; subject to Demand{j in Consumers}: sum{i in Suppliers}P[i,j]=demand[j]; subject to Supply{i in Suppliers}: sum{j in Consumers}P[i,j]=supply[i]; Run File: model biddingmulti3.mod; data biddingmulti3.dat; problem whole1: P, profit1, Demand, Supply; problem whole2: P, profit2, Demand, Supply; problem whole3: P, cost1, Demand, Supply; problem whole4: P, cost2, Demand, Supply; problem whole5: P, cost3, Demand, Supply; solve whole1; solve whole2; solve whole3; solve whole4; solve whole5; Here's the error I get: ILOG AMPL 9.100, licensed to "colorado-golden, co ", options: MaintenanceEnd=20110331 AMPL Version 20021038 (SunOS 5.8) ampl: include biddingmulti3.run; ILOG CPLEX 9.100, licensed to "colorado-golden, co ", options: e m b q use=10 MaintenanceEnd=20110331 CPLEX 9.1.0: optimal solution; objective 0 0 dual simplex iterations (0 in phase I) Objective = find a feasible point. ampl: display profit1; Error executing "display" command: No values for profit1. Does anyone know what my problem is? Also, is there a way to simplify my program because if I increase the number of consumers and suppliers it will be painful to write each objective function and each problem statement individually. Thanks a lot! Caroline --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/ampl?hl=en -~----------~----~----~----~------~----~------~--~--- |
Caroline, You write maximize profit1 {i in Suppliers: i=1}: sum {j in Consumers} bids[j] * P[1,j]; But the members of the set Suppliers are "S1" and "S2"; there is no member "1" in Suppliers. As a result, no profit1 objective is generated. A straightforward way to specify the objective you want would be maximize profit1: sum {j in Consumers} bids[j] * P["S1",j]; Your other objectives should be fixed similarly. Bob Fourer [hidden email] > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] On Behalf Of > [hidden email] > Sent: Wednesday, November 05, 2008 6:03 PM > To: AMPL Modeling Language > Subject: [AMPL 2062] Multi-objective modeling > > > Hi, > I'm trying to solve a multi-objective LP. I have a scenario with 2 > power suppliers and 3 consumers. The suppliers sell power to each > consumer. > I'm trying to maximize each suppliers profit individually and minimize > each consumers cost individually. Therefore I would have 5 objective > functions. > I also have 5 constraints: 3 for demand and 2 for supply. > Here's what I have so far: > Data file: > set Consumers:= C1 C2 C3; > set Suppliers:= S1 S2; > param bids:= > C1 4 > C2 7.5 > C3 6; > > param offers:= > S1 5 > S2 3; > > param supply:= > S1 30 > S2 20; > > param demand:= > C1 10 > C2 25 > C3 15; > > Model file: > set Consumers; > set Suppliers; > > param bids{j in Consumers}; > param offers{i in Suppliers}; > param supply{i in Suppliers}; > param demand{j in Consumers}; > > var P{i in Suppliers, j in Consumers}>=0; > > maximize profit1{i in Suppliers: i=1}:sum{j in Consumers} > bids[j]*P[1,j]; > maximize profit2{i in Suppliers: i=2}: sum{j in Consumers} > bids[j]*P[i,j]; > minimize cost1{j in Consumers:j=1}:sum{i in > Suppliers}offers[i]*P[i,j]; > minimize cost2{j in Consumers:j=2}: sum{i in Suppliers} > offers[i]*P[i,j]; > minimize cost3{j in Consumers:j=3}: sum{i in Suppliers} > offers[i]*P[i,j]; > subject to Demand{j in Consumers}: sum{i in > Suppliers}P[i,j]=demand[j]; > subject to Supply{i in Suppliers}: sum{j in > Consumers}P[i,j]=supply[i]; > > > > Run File: > > model biddingmulti3.mod; > data biddingmulti3.dat; > > problem whole1: P, profit1, Demand, Supply; > problem whole2: P, profit2, Demand, Supply; > problem whole3: P, cost1, Demand, Supply; > problem whole4: P, cost2, Demand, Supply; > problem whole5: P, cost3, Demand, Supply; > > solve whole1; > solve whole2; > solve whole3; > solve whole4; > solve whole5; > > > Here's the error I get: > ILOG AMPL 9.100, licensed to "colorado-golden, co ", options: > MaintenanceEnd=20110331 > AMPL Version 20021038 (SunOS 5.8) > ampl: include biddingmulti3.run; > ILOG CPLEX 9.100, licensed to "colorado-golden, co ", options: e m b q > use=10 MaintenanceEnd=20110331 > CPLEX 9.1.0: optimal solution; objective 0 > 0 dual simplex iterations (0 in phase I) > Objective = find a feasible point. > ampl: display profit1; > Error executing "display" command: > > No values for profit1. > > > Does anyone know what my problem is? > Also, is there a way to simplify my program because if I increase the > number of consumers and suppliers it will be painful to write each > objective function and each problem statement individually. > > > Thanks a lot! > > Caroline > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/ampl?hl=en -~----------~----~----~----~------~----~------~--~--- |
Thank you! :) On Nov 6, 8:19 am, "Robert Fourer" <[hidden email]> wrote: > Caroline, > > You write > > maximize profit1 {i in Suppliers: i=1}: > sum {j in Consumers} bids[j] * P[1,j]; > > But the members of the set Suppliers are "S1" and "S2"; there is no member > "1" in Suppliers. As a result, no profit1 objective is generated. A > straightforward way to specify the objective you want would be > > maximize profit1: > sum {j in Consumers} bids[j] * P["S1",j]; > > Your other objectives should be fixed similarly. > > Bob Fourer > [hidden email] > > > -----Original Message----- > > From: [hidden email] [mailto:[hidden email]] On Behalf Of > > [hidden email] > > Sent: Wednesday, November 05, 2008 6:03 PM > > To: AMPL Modeling Language > > Subject: [AMPL 2062] Multi-objective modeling > > > Hi, > > I'm trying to solve a multi-objective LP. I have a scenario with 2 > > power suppliers and 3 consumers. The suppliers sell power to each > > consumer. > > I'm trying to maximize each suppliers profit individually and minimize > > each consumers cost individually. Therefore I would have 5 objective > > functions. > > I also have 5 constraints: 3 for demand and 2 for supply. > > Here's what I have so far: > > Data file: > > set Consumers:= C1 C2 C3; > > set Suppliers:= S1 S2; > > param bids:= > > C1 4 > > C2 7.5 > > C3 6; > > > param offers:= > > S1 5 > > S2 3; > > > param supply:= > > S1 30 > > S2 20; > > > param demand:= > > C1 10 > > C2 25 > > C3 15; > > > Model file: > > set Consumers; > > set Suppliers; > > > param bids{j in Consumers}; > > param offers{i in Suppliers}; > > param supply{i in Suppliers}; > > param demand{j in Consumers}; > > > var P{i in Suppliers, j in Consumers}>=0; > > > maximize profit1{i in Suppliers: i=1}:sum{j in Consumers} > > bids[j]*P[1,j]; > > maximize profit2{i in Suppliers: i=2}: sum{j in Consumers} > > bids[j]*P[i,j]; > > minimize cost1{j in Consumers:j=1}:sum{i in > > Suppliers}offers[i]*P[i,j]; > > minimize cost2{j in Consumers:j=2}: sum{i in Suppliers} > > offers[i]*P[i,j]; > > minimize cost3{j in Consumers:j=3}: sum{i in Suppliers} > > offers[i]*P[i,j]; > > subject to Demand{j in Consumers}: sum{i in > > Suppliers}P[i,j]=demand[j]; > > subject to Supply{i in Suppliers}: sum{j in > > Consumers}P[i,j]=supply[i]; > > > Run File: > > > model biddingmulti3.mod; > > data biddingmulti3.dat; > > > problem whole1: P, profit1, Demand, Supply; > > problem whole2: P, profit2, Demand, Supply; > > problem whole3: P, cost1, Demand, Supply; > > problem whole4: P, cost2, Demand, Supply; > > problem whole5: P, cost3, Demand, Supply; > > > solve whole1; > > solve whole2; > > solve whole3; > > solve whole4; > > solve whole5; > > > Here's the error I get: > > ILOG AMPL 9.100, licensed to "colorado-golden, co ", options: > > MaintenanceEnd=20110331 > > AMPL Version 20021038 (SunOS 5.8) > > ampl: include biddingmulti3.run; > > ILOG CPLEX 9.100, licensed to "colorado-golden, co ", options: e m b q > > use=10 MaintenanceEnd=20110331 > > CPLEX 9.1.0: optimal solution; objective 0 > > 0 dual simplex iterations (0 in phase I) > > Objective = find a feasible point. > > ampl: display profit1; > > Error executing "display" command: > > > No values for profit1. > > > Does anyone know what my problem is? > > Also, is there a way to simplify my program because if I increase the > > number of consumers and suppliers it will be painful to write each > > objective function and each problem statement individually. > > > Thanks a lot! > > > Caroline --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/ampl?hl=en -~----------~----~----~----~------~----~------~--~--- |
Free forum by Nabble | Edit this page |