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