source: src/main/java/negotiator/onetomany/Utility.java@ 226

Last change on this file since 226 was 226, checked in by Faria Nassiri Mofakham, 6 years ago

GUI updated (using Jpanel). DemandPlanDrawing updated. PutImaged renamed to DrawImage. DemandPlan is updating for the Utility, Bid, and Preference classes. Protocol and Agents packages (and some classes) added.

File size: 1011 bytes
RevLine 
[226]1package negotiator.onetomany;
2
3import java.util.ArrayList;
4import java.util.Iterator;
5
6import org.apache.commons.math3.analysis.function.Abs;
7
8public class Utility
9{
10 Bid bid;
11
12 public Utility()
13 {
14 Product redProduct = new Product("Red");
15 Product pinkProduct = new Product("Pink");
16 Product blueProduct = new Product("Blue");
17
18 Bid desiredBid = new Bid();
19 desiredBid.setQuantity(redProduct, 4);
20 desiredBid.setQuantity(pinkProduct, 4);
21 desiredBid.setQuantity(blueProduct, 2);
22
23
24
25
26 for (Product product : portfolio.getPortfolio())
27 demandPlan.setQuantity(product, (int)(Math.random()*numType+1));
28
29
30 double weight[]= {0.6,0.3,0.1};
31
32 for (Product product : bid.getBid().keySet())
33 {
34 Integer q = bid.getQuantity(product);
35
36 int sum += Abs(desierdQTY[bid.getKeys()]-q)*weight[product];
37 }
38
39this.getUtility=sum
40
41 this.utility = new ArrayList<Product>();
42 }
43
44 double getUtility(Bid b)
45 {
46
47 return
48 }
49
50
51}
Note: See TracBrowser for help on using the repository browser.