[233] | 1 | /**
|
---|
| 2 | * Test class
|
---|
| 3 | */
|
---|
[253] | 4 | package onetomany;
|
---|
[233] | 5 |
|
---|
| 6 | import java.awt.Color;
|
---|
| 7 |
|
---|
[253] | 8 | import onetomany.bargainingchipsgame.Bundle;
|
---|
| 9 | import onetomany.bargainingchipsgame.Chip;
|
---|
| 10 | import onetomany.bargainingchipsgame.Stack;
|
---|
| 11 | import onetomany.bargainingchipsgame.players.Agent;
|
---|
| 12 | import onetomany.bargainingchipsgame.players.utilityfunction.UF_75pQtyOrNothing;
|
---|
| 13 | import onetomany.bargainingchipsgame.players.utilityfunction.UF_AllOrNothing;
|
---|
| 14 | import onetomany.bargainingchipsgame.players.utilityfunction.UF_FreeDisposal;
|
---|
| 15 | import onetomany.bargainingchipsgame.players.utilityfunction.UF_IWant3Red;
|
---|
| 16 | import onetomany.bargainingchipsgame.players.utilityfunction.UF_IWantColorAndQuantity;
|
---|
| 17 | import onetomany.bargainingchipsgame.players.utilityfunction.UF_Nice;
|
---|
| 18 | import onetomany.bargainingchipsgame.players.utilityfunction.UF_Silly;
|
---|
| 19 | import onetomany.bargainingchipsgame.players.utilityfunction.UF_prcntQTYandprcntPrice;
|
---|
| 20 | import onetomany.bargainingchipsgame.players.utilityfunction.Utility_Function;
|
---|
[243] | 21 |
|
---|
[233] | 22 | /**
|
---|
| 23 | * This class is for creating Chips, Stacks, and Bundles to test the operations
|
---|
| 24 | *
|
---|
| 25 | * @author Faria Nassiri-Mofakham
|
---|
| 26 | *
|
---|
| 27 | */
|
---|
| 28 |
|
---|
[239] | 29 | public class test
|
---|
| 30 | {
|
---|
[233] | 31 |
|
---|
| 32 | /**
|
---|
| 33 | * @param args
|
---|
| 34 | */
|
---|
[239] | 35 | public static void main(String[] args)
|
---|
| 36 | {
|
---|
[233] | 37 | // TODO
|
---|
| 38 | Chip chip1=new Chip("Pink", 5);
|
---|
| 39 | System.out.println("\nChip1: "+chip1);
|
---|
| 40 | Stack stack1=new Stack(chip1,12);
|
---|
| 41 | System.out.println("\nTEST1:::Stack1: "+stack1+", its price is "+stack1.getPrice());
|
---|
| 42 |
|
---|
| 43 | System.out.println("\n-----");
|
---|
| 44 |
|
---|
| 45 | Chip chip2=new Chip("Orange", 7);
|
---|
| 46 | System.out.println("\nChip2: "+chip2);
|
---|
| 47 | Stack stack2=new Stack(chip2,9);
|
---|
| 48 | System.out.println("\nTEST1:::Stack2: "+stack2+", its price is "+stack2.getPrice());
|
---|
| 49 |
|
---|
| 50 | System.out.println("\n-----");
|
---|
[243] | 51 |
|
---|
[236] | 52 | Chip c1=new Chip();
|
---|
| 53 | c1.setRandomColor();
|
---|
| 54 | double p1=100; double p2=1000;
|
---|
| 55 | c1.setRandomPrice(p1,p2);
|
---|
| 56 | System.out.println("With random defined color, and random price between "+p1+" and "+p2+", the Chip: "+c1);
|
---|
[243] | 57 |
|
---|
[236] | 58 | System.out.println("\n-----");
|
---|
[243] | 59 |
|
---|
[236] | 60 | Chip c2=new Chip();
|
---|
| 61 | c2.setColorRandomRGB();
|
---|
| 62 | c2.setRandomPrice(p1,p2);
|
---|
| 63 | System.out.println("With random RGB color, and random price between "+p1+" and "+p2+", the Chip: "+c2);
|
---|
[243] | 64 |
|
---|
| 65 |
|
---|
| 66 |
|
---|
[236] | 67 | System.out.println("\n-----");
|
---|
[233] | 68 |
|
---|
| 69 | Bundle bundle1 = new Bundle();
|
---|
| 70 |
|
---|
| 71 | bundle1.addStack(stack1);
|
---|
| 72 | bundle1.addStack(stack2);
|
---|
| 73 |
|
---|
| 74 | System.out.println("\nTEST2:::Bundle1: "+bundle1);
|
---|
| 75 |
|
---|
[243] | 76 |
|
---|
[233] | 77 | //generating a bundle with stacks in random colors, random unit price, and random quantity
|
---|
| 78 | Bundle bundle2 = new Bundle();
|
---|
| 79 | for (int i=1; i<5;i++)
|
---|
| 80 | {
|
---|
| 81 | // int r=(int)(Math.random()*266; int g=(int)(Math.random()*266; int b=(int)(Math.random()*266;
|
---|
| 82 | // Color c=new Color((int)(Math.random()*255),(int)(Math.random()*255),(int)(Math.random()*255));
|
---|
| 83 | bundle2.addStack(new Stack(new Chip(new Color((int)(Math.random()*255+1),(int)(Math.random()*255+1),(int)(Math.random()*255+1)).toString(), (double)(Math.random()*20+1)), (int)(Math.random()*10+1)));
|
---|
| 84 |
|
---|
| 85 | }
|
---|
| 86 |
|
---|
| 87 | System.out.println("\nTEST3:::Bundle2: "+bundle2);
|
---|
| 88 |
|
---|
| 89 |
|
---|
| 90 | Bundle bundle3= new Bundle();
|
---|
| 91 | bundle3.addStack(new Stack(new Chip("Red", 5), 17));
|
---|
| 92 | bundle3.addStack(new Stack(new Chip("Green", 7), 15));
|
---|
| 93 | bundle3.addStack(new Stack(new Chip("Blue", 10), 3));
|
---|
| 94 | bundle3.addStack(new Stack(new Chip("Pink", 2), 1));
|
---|
| 95 | bundle3.addStack(new Stack(new Chip("Orange", 1), 4));
|
---|
| 96 |
|
---|
| 97 | System.out.println("\nTEST4:::Bundle3: "+bundle3);
|
---|
| 98 |
|
---|
| 99 | Bundle bundle4= new Bundle();
|
---|
| 100 |
|
---|
| 101 | Bundle bundle5=null;
|
---|
| 102 |
|
---|
| 103 | System.out.println("\nBundle4: "+bundle4+"\nBundle5: "+bundle5);
|
---|
| 104 |
|
---|
| 105 | System.out.println("\n-----");
|
---|
| 106 |
|
---|
| 107 |
|
---|
[236] | 108 | System.out.println("\n*TEST5::: Aggregating stack1: "+stack1+" into stack2: "+stack2+" results in "+stack2.aggregateWith(stack1));
|
---|
[233] | 109 |
|
---|
| 110 |
|
---|
| 111 | System.out.println("\n-----");
|
---|
| 112 |
|
---|
| 113 | Stack s=null;
|
---|
| 114 |
|
---|
[236] | 115 |
|
---|
[243] | 116 |
|
---|
[236] | 117 | System.out.println("\n*TEST6-01:::Stack1: "+stack1+" is aggregated with ``null Stack'' as follows:\n"+stack1.aggregateWith(s));
|
---|
| 118 |
|
---|
[243] | 119 |
|
---|
[233] | 120 | System.out.println("\n-----");
|
---|
[243] | 121 |
|
---|
[236] | 122 | Stack ss=new Stack(new Chip("Orange", 8),40);
|
---|
[243] | 123 | // System.out.println("\n*TEST6-02:::Bundle1: "+bundle1+" is aggregated with Stack "+ss+" as follows:\n"+bundle1.aggregateWith(ss));
|
---|
[233] | 124 |
|
---|
[236] | 125 |
|
---|
| 126 |
|
---|
[243] | 127 | // System.out.println("\n*TEST6:::Bundle1: "+bundle1+" is aggregated with Stack: 40 x Chip(Yellow, 8$) as follows:\n"+bundle1.aggregateWith(new Stack(new Chip("Yellow", 8),40)));
|
---|
[236] | 128 |
|
---|
[243] | 129 |
|
---|
[236] | 130 | Stack sss=new Stack(new Chip("Cyan", 5),16);
|
---|
| 131 |
|
---|
[243] | 132 | // System.out.println("\n*TEST6-03:::Bundle1: "+bundle1+" is aggregated with Stack "+sss+" as follows:\n"+bundle1.aggregateWith(sss));
|
---|
[236] | 133 |
|
---|
[243] | 134 |
|
---|
[233] | 135 | System.out.println("\n-----");
|
---|
| 136 |
|
---|
[236] | 137 | Stack ssss=null;
|
---|
| 138 |
|
---|
[243] | 139 | // System.out.println("\n*TEST7:::Bundle1: "+bundle1+" is aggregated with ``null Stack'' as follows:\n"+bundle1.aggregateWith(ssss));
|
---|
| 140 |
|
---|
| 141 |
|
---|
| 142 |
|
---|
[236] | 143 | System.out.println("\n-----");
|
---|
| 144 |
|
---|
[233] | 145 | System.out.println("\n*TEST8:::Bundle1: "+bundle1+" is aggregated with ``null bundle'' as follows:\n"+bundle1.aggregateWith(bundle5));
|
---|
| 146 |
|
---|
| 147 | System.out.println("\n-----");
|
---|
| 148 |
|
---|
| 149 | System.out.println("\n*TEST9:::Bundle1: "+bundle1+" is aggregated with Bundle3: "+bundle3+" as follows:\n"+ bundle1.aggregateWith(bundle3));
|
---|
| 150 |
|
---|
| 151 | System.out.println("\n-----");
|
---|
| 152 |
|
---|
| 153 | System.out.println("\n-----");
|
---|
| 154 |
|
---|
[243] | 155 |
|
---|
| 156 |
|
---|
[236] | 157 | Bundle b1=new Bundle();
|
---|
| 158 | b1.addStack(new Stack(new Chip("Red", 1), 10));
|
---|
| 159 | b1.addStack(new Stack(new Chip("Blue", 8), 30));
|
---|
| 160 | b1.addStack(new Stack(new Chip("Orange", 4), 30));
|
---|
| 161 | b1.addStack(new Stack(new Chip("Pink", 8), 80));
|
---|
[233] | 162 |
|
---|
| 163 |
|
---|
| 164 |
|
---|
[243] | 165 |
|
---|
[236] | 166 | Bundle b2=new Bundle();
|
---|
| 167 | b2.addStack(new Stack(new Chip("Red", 3), 20));
|
---|
[243] | 168 |
|
---|
[236] | 169 | Bundle b3=new Bundle();
|
---|
| 170 | b3.addStack(new Stack(new Chip("Blue", 4), 30));
|
---|
| 171 | b3.addStack(new Stack(new Chip("Orange", 6), 20));
|
---|
[233] | 172 |
|
---|
[236] | 173 | Bundle b4=new Bundle();
|
---|
| 174 | b4.addStack(new Stack(new Chip("White", 4), 30));
|
---|
| 175 | b4.addStack(new Stack(new Chip("Yellow", 6), 20));
|
---|
[233] | 176 |
|
---|
[243] | 177 |
|
---|
[236] | 178 | Bundle b5=new Bundle();
|
---|
| 179 | b5.addStack(new Stack(new Chip("Cyan", 7), 90));
|
---|
| 180 |
|
---|
[243] | 181 |
|
---|
| 182 |
|
---|
[236] | 183 | Bundle b6=new Bundle();
|
---|
| 184 | b6.addStack(new Stack(new Chip("Red", 9), 10));
|
---|
[243] | 185 |
|
---|
| 186 |
|
---|
[236] | 187 | Bundle bbb=new Bundle();
|
---|
| 188 | bbb=b3;
|
---|
| 189 | System.out.println("\n*TEST::: "+bbb);
|
---|
| 190 |
|
---|
| 191 | System.out.println("\n-----aggregateWith----");
|
---|
| 192 |
|
---|
| 193 |
|
---|
[243] | 194 |
|
---|
| 195 |
|
---|
[236] | 196 | System.out.println("\n-----BUNDLEaggregateWithBundle-----");
|
---|
| 197 |
|
---|
| 198 |
|
---|
| 199 | System.out.println("\n*TEST10-01::: Without shared colors ::: single stack B2: "+b2+" is aggregated2 with ``null'' bundle5 as follows:\n"+ b2.aggregateWith(bundle5));
|
---|
| 200 |
|
---|
[243] | 201 |
|
---|
[236] | 202 | System.out.println("\n*TEST10-02::: Without shared colors ::: multi stack B1: "+b1+" is aggregated2 with ``null'' bundle5 as follows:\n"+ b1.aggregateWith(bundle5));
|
---|
[243] | 203 |
|
---|
| 204 |
|
---|
[236] | 205 | System.out.println("\n*TEST10-03::: Without shared colors ::: single stack B2: "+b2+" is aggregated2 with single stack B5: "+b5+" as follows:\n"+ b2.aggregateWith(b5));
|
---|
| 206 |
|
---|
| 207 | System.out.println("\n*TEST10-04::: Without shared colors ::: single stack B2: "+b2+" is aggregated2 with multi stack B3: "+b3+" as follows:\n"+ b2.aggregateWith(b3));
|
---|
| 208 |
|
---|
| 209 | System.out.println("\n*TEST10-05::: With shared colors ::: single stack B2: "+b2+" is aggregated2 with single stack B5: "+b6+" as follows:\n"+ b2.aggregateWith(b6));
|
---|
| 210 |
|
---|
| 211 | System.out.println("\n*TEST10-06::: With shared colors ::: single stack B2: "+b2+" is aggregated2 with multi stack B3: "+b1+" as follows:\n"+ b2.aggregateWith(b1));
|
---|
| 212 |
|
---|
[243] | 213 |
|
---|
[236] | 214 | System.out.println("\n*TEST10-07::: With shared colors ::: multi stack B1: "+b1+" is aggregated2 with multi stack B3: "+b3+" as follows:\n"+ b1.aggregateWith(b3));
|
---|
| 215 |
|
---|
| 216 |
|
---|
| 217 | System.out.println("\n*TEST10-08::: With shared colors ::: multi stack B1: "+b1+" is aggregated2 with single stack B2: "+b2+" as follows:\n"+ b1.aggregateWith(b2));
|
---|
[243] | 218 |
|
---|
[236] | 219 | System.out.println("\n*TEST10-09::: Without shared colors ::: multi stack B1: "+b1+" is aggregated2 with multi stack B2: "+b4+" as follows:\n"+ b1.aggregateWith(b4));
|
---|
| 220 |
|
---|
[243] | 221 | System.out.println("\n-----BUNDLEaggregateWith333Bundle-----");
|
---|
| 222 |
|
---|
| 223 |
|
---|
| 224 |
|
---|
| 225 | System.out.println("\n*TEST10-01::: Without shared colors ::: single stack B2: "+b2+" is aggregated333 with ``null'' bundle5 as follows:\n"+ b2.aggregateWith333(bundle5));
|
---|
| 226 |
|
---|
| 227 |
|
---|
| 228 | System.out.println("\n*TEST10-02::: Without shared colors ::: multi stack B1: "+b1+" is aggregated333 with ``null'' bundle5 as follows:\n"+ b1.aggregateWith333(bundle5));
|
---|
| 229 |
|
---|
| 230 |
|
---|
| 231 | System.out.println("\n*TEST10-03::: Without shared colors ::: single stack B2: "+b2+" is aggregated333 with single stack B5: "+b5+" as follows:\n"+ b2.aggregateWith333(b5));
|
---|
| 232 |
|
---|
| 233 | System.out.println("\n*TEST10-04::: Without shared colors ::: single stack B2: "+b2+" is aggregated333 with multi stack B3: "+b3+" as follows:\n"+ b2.aggregateWith333(b3));
|
---|
| 234 |
|
---|
| 235 | System.out.println("\n*TEST10-05::: With shared colors ::: single stack B2: "+b2+" is aggregated333 with single stack B5: "+b6+" as follows:\n"+ b2.aggregateWith333(b6));
|
---|
| 236 |
|
---|
| 237 | System.out.println("\n*TEST10-06::: With shared colors ::: single stack B2: "+b2+" is aggregated333 with multi stack B3: "+b1+" as follows:\n"+ b2.aggregateWith333(b1));
|
---|
| 238 |
|
---|
| 239 |
|
---|
| 240 | System.out.println("\n*TEST10-07::: With shared colors ::: multi stack B1: "+b1+" is aggregated333 with multi stack B3: "+b3+" as follows:\n"+ b1.aggregateWith333(b3));
|
---|
| 241 |
|
---|
| 242 |
|
---|
| 243 | System.out.println("\n*TEST10-08::: With shared colors ::: multi stack B1: "+b1+" is aggregated333 with single stack B2: "+b2+" as follows:\n"+ b1.aggregateWith333(b2));
|
---|
| 244 |
|
---|
| 245 | System.out.println("\n*TEST10-09::: Without shared colors ::: multi stack B1: "+b1+" is aggregated333 with multi stack B2: "+b4+" as follows:\n"+ b1.aggregateWith333(b4));
|
---|
| 246 |
|
---|
[236] | 247 |
|
---|
| 248 |
|
---|
[243] | 249 | System.out.println("\n-----TEST11: Agent creations -----");
|
---|
| 250 |
|
---|
[236] | 251 |
|
---|
[243] | 252 |
|
---|
| 253 | Utility_Function u1=new UF_IWant3Red();
|
---|
| 254 | Agent belinda = new Agent();//bundle3, u, 10, null);
|
---|
| 255 | belinda.setName("Belinda");
|
---|
| 256 | belinda.setWishlist(bundle3);
|
---|
| 257 | belinda.setUtility(u1);
|
---|
| 258 | belinda.setDeadline(10);
|
---|
| 259 |
|
---|
| 260 | System.out.println("\n"+belinda+"\nTEST11-01* utility of aggregated bundle TEST10-09 "+b1.aggregateWith(b4)+"\nfor "+belinda.getName()+" is: "+belinda.getUtility().getUtility(b1.aggregateWith(b4)));
|
---|
| 261 |
|
---|
| 262 |
|
---|
| 263 | Utility_Function u2=new UF_Nice();
|
---|
| 264 | Agent bella = new Agent();//bundle3, u, 10, null);
|
---|
| 265 | bella.setName("Bella");
|
---|
| 266 | bella.setWishlist(bundle3);
|
---|
| 267 | bella.setUtility(u2);
|
---|
| 268 | bella.setDeadline(100);
|
---|
| 269 |
|
---|
| 270 | System.out.println("\n"+bella+"\nTEST11-02* utility of aggregated bundle TEST10-09 "+b1.aggregateWith(b4)+"\nfor "+bella.getName()+" is: "+bella.getUtility().getUtility(b1.aggregateWith(b4)));
|
---|
| 271 |
|
---|
| 272 |
|
---|
| 273 | Utility_Function u4=new UF_AllOrNothing(bundle3);
|
---|
| 274 | Agent sam = new Agent();
|
---|
| 275 | sam.setName("Sam");
|
---|
| 276 | sam.setWishlist(bundle3);
|
---|
| 277 | sam.setUtility(u4);
|
---|
| 278 | sam.setDeadline(1000);
|
---|
| 279 |
|
---|
| 280 | System.out.println("\n"+sam+"\nTEST11-04* utility of bundle3 "+bundle3+"\nfor "+sam.getName()+" is: "+sam.getUtility().getUtility(bundle3));
|
---|
| 281 |
|
---|
| 282 |
|
---|
| 283 | Bundle a=new Bundle();
|
---|
| 284 | a.addStack(new Stack(new Chip("Blue", 4), 30));
|
---|
| 285 | a.addStack(new Stack(new Chip("Orange", 6), 20));
|
---|
| 286 |
|
---|
| 287 | Bundle aa=new Bundle();
|
---|
| 288 | aa.addStack(new Stack(new Chip("Orange", 6), 20));
|
---|
| 289 | aa.addStack(new Stack(new Chip("Blue", 4), 30));
|
---|
| 290 |
|
---|
| 291 |
|
---|
| 292 |
|
---|
| 293 | Utility_Function u5=new UF_AllOrNothing(a);
|
---|
| 294 | Agent simon = new Agent();
|
---|
| 295 | simon.setName("Simon");
|
---|
| 296 | simon.setWishlist(a);
|
---|
| 297 | simon.setUtility(u5);
|
---|
| 298 | simon.setDeadline(1000);
|
---|
| 299 |
|
---|
| 300 | System.out.println("\n"+simon+"\nTEST11-05* utility of bundle aa "+aa+"\nfor "+simon.getName()+" is: "+simon.getUtility().getUtility(aa));
|
---|
| 301 |
|
---|
| 302 |
|
---|
[236] | 303 |
|
---|
[243] | 304 | Bundle aaa=new Bundle();
|
---|
| 305 | aaa.addStack(new Stack(new Chip("Orange", 6), 20));
|
---|
| 306 | aaa.addStack(new Stack(new Chip("Blue", 4), 30));
|
---|
| 307 | aaa.addStack(new Stack(new Chip("White", 4), 30));
|
---|
| 308 |
|
---|
| 309 |
|
---|
| 310 | Utility_Function u6=new UF_FreeDisposal(aaa);
|
---|
| 311 | Agent bethy = new Agent();
|
---|
| 312 | bethy.setName("Bethy");
|
---|
| 313 | bethy.setWishlist(aaa);
|
---|
| 314 | bethy.setUtility(u6);
|
---|
| 315 | bethy.setDeadline(1000);
|
---|
| 316 |
|
---|
| 317 |
|
---|
| 318 | System.out.println("\n"+bethy+"\nTEST11-06* utility of bundle aa "+aa+"\nfor "+bethy.getName()+" is: "+bethy.getUtility().getUtility(aa));
|
---|
| 319 |
|
---|
| 320 | System.out.println("\n"+bethy+"\nTEST11-07* utility of bundle aaa "+aaa+"\nfor "+bethy.getName()+" is: "+bethy.getUtility().getUtility(aaa));
|
---|
| 321 |
|
---|
| 322 | Bundle aaaa=new Bundle();
|
---|
| 323 | aaaa.addStack(new Stack(new Chip("Orange", 6), 20));
|
---|
| 324 |
|
---|
| 325 | System.out.println("\n"+bethy+"\nTEST11-08* utility of bundle aaaa "+aaaa+"\nfor "+bethy.getName()+" is: "+bethy.getUtility().getUtility(aaaa));
|
---|
| 326 |
|
---|
| 327 |
|
---|
| 328 |
|
---|
| 329 |
|
---|
| 330 | Utility_Function u8=new UF_Silly();
|
---|
| 331 | Agent sterling = new Agent();
|
---|
| 332 | sterling.setName("Sterling");
|
---|
| 333 | sterling.setWishlist(a);
|
---|
| 334 | sterling.setUtility(u8);
|
---|
| 335 | sterling.setDeadline(10);
|
---|
| 336 |
|
---|
| 337 | System.out.println("\n"+sterling+"\nTEST11-09* utility of bundle a "+a+"\nfor "+sterling.getName()+" is: "+sterling.getUtility().getUtility(a));
|
---|
| 338 |
|
---|
| 339 | System.out.println("\n"+sterling+"\nTEST11-10* utility of bundle aaaa "+aaaa+"\nfor "+sterling.getName()+" is: "+sterling.getUtility().getUtility(aaaa));
|
---|
| 340 |
|
---|
| 341 | System.out.println("\n"+sterling+"\nTEST11-11* utility of bundle aaa "+aaa+"\nfor "+sterling.getName()+" is: "+sterling.getUtility().getUtility(aaa));
|
---|
| 342 |
|
---|
| 343 |
|
---|
| 344 |
|
---|
| 345 | String c="Blue";
|
---|
| 346 | int q=30;
|
---|
| 347 | Bundle w=new Bundle();
|
---|
| 348 | w.addStack(new Stack(new Chip(c,10),q));
|
---|
| 349 |
|
---|
| 350 | Utility_Function u9=new UF_IWantColorAndQuantity(c, q);
|
---|
| 351 | Agent sandra = new Agent();
|
---|
| 352 | sandra.setName("Sandra");
|
---|
| 353 | sandra.setWishlist(w); // there should be a better way to bring those parameters for making the wishlist at time of calling the utility function
|
---|
| 354 | sandra.setUtility(u9);
|
---|
| 355 | sandra.setDeadline(10);
|
---|
| 356 |
|
---|
| 357 | System.out.println("\n"+sandra+"\nTEST11-09* utility of bundle a "+a+"\nfor "+sandra.getName()+" is: "+sandra.getUtility().getUtility(a));
|
---|
| 358 |
|
---|
| 359 | System.out.println("\n"+sandra+"\nTEST11-10* utility of bundle aaaa "+aaaa+"\nfor "+sandra.getName()+" is: "+sandra.getUtility().getUtility(aaaa));
|
---|
| 360 |
|
---|
| 361 | System.out.println("\n"+sandra+"\nTEST11-11* utility of bundle aaa "+aaa+"\nfor "+sandra.getName()+" is: "+sandra.getUtility().getUtility(aaa));
|
---|
| 362 |
|
---|
| 363 |
|
---|
| 364 | System.out.println("\n========================IT IS UF_prcntQTYandprcntPrice=========================");
|
---|
| 365 |
|
---|
| 366 |
|
---|
| 367 | Utility_Function u3=new UF_prcntQTYandprcntPrice(b3,0.5,0.5);
|
---|
| 368 | Agent bob = new Agent();
|
---|
| 369 | bob.setName("Bob");
|
---|
| 370 | bob.setWishlist(b3);
|
---|
| 371 | bob.setUtility(u3);
|
---|
| 372 | bob.setDeadline(100);
|
---|
| 373 |
|
---|
| 374 | System.out.println("\n"+bob+"\nTEST11-03* utility of b1 "+b3+"\nfor "+bob.getName()+" is: "+bob.getUtility().getUtility(b3)+"\n"+bob.getWishlist().getPrice()+"\n"+b3.getPrice());
|
---|
| 375 |
|
---|
| 376 | System.out.println("\n"+bob+"\nTEST11-033* utility of b1 "+b1+"\nfor "+bob.getName()+" is: "+bob.getUtility().getUtility(b1)+"\n"+bob.getWishlist().getPrice()+"\n"+b1.getPrice());
|
---|
| 377 |
|
---|
| 378 | System.out.println("\n"+bob+"\nTEST11-0333* utility of b1 "+aaa+"\nfor "+bob.getName()+" is: "+bob.getUtility().getUtility(aaa)+"\n"+bob.getWishlist().getPrice()+"\n"+aaa.getPrice());
|
---|
| 379 |
|
---|
| 380 |
|
---|
| 381 |
|
---|
| 382 |
|
---|
| 383 |
|
---|
| 384 | Utility_Function u33=new UF_prcntQTYandprcntPrice(b3,0.1,0.1);
|
---|
| 385 | Agent bob33 = new Agent();
|
---|
| 386 | bob33.setName("Bob33");
|
---|
| 387 | bob33.setWishlist(b3);
|
---|
| 388 | bob33.setUtility(u33);
|
---|
| 389 | bob33.setDeadline(100);
|
---|
| 390 |
|
---|
| 391 | System.out.println("\n"+bob33+"\nTEST11-03* utility of b1 "+b3+"\nfor "+bob33.getName()+" is: "+bob33.getUtility().getUtility(b3)+"\n"+bob33.getWishlist().getPrice()+"\n"+b3.getPrice());
|
---|
| 392 |
|
---|
| 393 | System.out.println("\n"+bob33+"\nTEST11-033* utility of b1 "+b1+"\nfor "+bob33.getName()+" is: "+bob33.getUtility().getUtility(b1)+"\n"+bob33.getWishlist().getPrice()+"\n"+b1.getPrice());
|
---|
| 394 |
|
---|
| 395 | System.out.println("\n"+bob33+"\nTEST11-0333* utility of b1 "+aaa+"\nfor "+bob33.getName()+" is: "+bob33.getUtility().getUtility(aaa)+"\n"+bob33.getWishlist().getPrice()+"\n"+aaa.getPrice());
|
---|
| 396 |
|
---|
| 397 |
|
---|
| 398 |
|
---|
| 399 |
|
---|
| 400 |
|
---|
| 401 |
|
---|
| 402 | Utility_Function u333=new UF_prcntQTYandprcntPrice(b3,0.8,0.8);
|
---|
| 403 | Agent bob333 = new Agent();
|
---|
| 404 | bob333.setName("Bob333");
|
---|
| 405 | bob333.setWishlist(b3);
|
---|
| 406 | bob333.setUtility(u333);
|
---|
| 407 | bob333.setDeadline(100);
|
---|
| 408 |
|
---|
| 409 | System.out.println("\n"+bob333+"\nTEST11-03* utility of b1 "+b3+"\nfor "+bob333.getName()+" is: "+bob333.getUtility().getUtility(b3)+"\n"+bob333.getWishlist().getPrice()+"\n"+b3.getPrice());
|
---|
| 410 |
|
---|
| 411 | System.out.println("\n"+bob333+"\nTEST11-033* utility of b1 "+b1+"\nfor "+bob333.getName()+" is: "+bob333.getUtility().getUtility(b1)+"\n"+bob333.getWishlist().getPrice()+"\n"+b1.getPrice());
|
---|
| 412 |
|
---|
| 413 | System.out.println("\n"+bob333+"\nTEST11-0333* utility of b1 "+aaa+"\nfor "+bob333.getName()+" is: "+bob333.getUtility().getUtility(aaa)+"\n"+bob333.getWishlist().getPrice()+"\n"+aaa.getPrice());
|
---|
| 414 |
|
---|
| 415 |
|
---|
| 416 |
|
---|
| 417 | Utility_Function u7=new UF_75pQtyOrNothing(a);
|
---|
| 418 | Agent barbara = new Agent();
|
---|
| 419 | barbara.setName("Barbara");
|
---|
| 420 | barbara.setWishlist(a);
|
---|
| 421 | barbara.setUtility(u7);
|
---|
| 422 | barbara.setDeadline(10);
|
---|
| 423 |
|
---|
| 424 | System.out.println("\n"+barbara+"\nTEST11-09* utility of bundle a "+a+"\nfor "+barbara.getName()+" is: "+barbara.getUtility().getUtility(a)+" size of wishlist "+barbara.getWishlist().size()+ " "+(double)barbara.getWishlist().size()*0.75);
|
---|
| 425 |
|
---|
| 426 | System.out.println("\n"+barbara+"\nTEST11-10* utility of bundle aaaa "+aaaa+"\nfor "+barbara.getName()+" is: "+barbara.getUtility().getUtility(aaaa));
|
---|
| 427 |
|
---|
| 428 | System.out.println("\n"+barbara+"\nTEST11-11* utility of bundle aaa "+aaa+"\nfor "+barbara.getName()+" is: "+barbara.getUtility().getUtility(aaa));
|
---|
| 429 |
|
---|
| 430 |
|
---|
| 431 | }
|
---|
| 432 |
|
---|
[236] | 433 | }
|
---|