HomeDigital EditionSys-Con RadioSearch Java Cd
Advanced Java AWT Book Reviews/Excerpts Client Server Corba Editorials Embedded Java Enterprise Java IDE's Industry Watch Integration Interviews Java Applet Java & Databases Java & Web Services Java Fundamentals Java Native Interface Java Servlets Java Beans J2ME Libraries .NET Object Orientation Observations/IMHO Product Reviews Scalability & Performance Security Server Side Source Code Straight Talking Swing Threads Using Java with others Wireless XML

"Optimization And Java"
Vol. 6, Issue 6, p. 116


Listing 1

enum Country {Belgium,Denmark,France,
enum Colors {blue,red,yellow,gray};
var Colors color[Country];
solve {
     color[France] <> color[Belgium];
     color[France] <> color[Luxembourg];
     color[France] <> color[Germany];
     color[Luxembourg] <> color[Germany];
     color[Luxembourg] <> color[Belgium];
     color[Belgium] <> color[Netherlands];
     color[Belgium] <> color[Germany];
     color[Germany] <> color[Netherlands];
     color[Germany] <> color[Denmark];

Listing 2 enum Products ...; enum Resources ...;

struct ProductData {
   float demand;
   float insideCost;
   float outsideCost;
   float consumption[Resources];

ProductData product[Products] = ...;
float capacity[Resources] = ...;

var float inside[Products];
var float outside[Products];

   sum(p in Products) (product[p].insideCost*inside[p] 
subject to {
   forall(r in Resources)
      sum(p in Products) product[p].consumption[r] * inside[p]
             <= capacity[r];

   forall(p in Products)
      inside[p] outside[p] >= product[p].demand;


All Rights Reserved
Copyright ©  2004 SYS-CON Media, Inc.
  E-mail: [email protected]

Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.