CoJava: Optimization Modeling by Nondeterministic Simulation

  • Alexander Brodsky
  • Hadon Nash
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4204)


We have proposed and implemented the language CoJava, which offers both the advantages of simulation-like process modeling in Java, and the capabilities of true decision optimization. By design, the syntax of CoJava is identical to the programming language Java, extended with special constructs to (1) make a nondeterministic choice of a numeric value, (2) assert a constraint, and (3) designate a program variable as the objective to be optimized. A sequence of specific selections in nondeterministic choice statements corresponds to an execution path. We define an optimal execution path as one that (1) satisfies the range conditions in the choice statements, (2) satisfies the assert-constraint statements, and (3) produces the optimal value in a designated program variable, among all execution paths that satisfy (1) and (2). The semantics of a CoJava program amounts to first finding an optimal execution path, and then procedurally executing it. To find an optimal execution path, the implemented CoJava compiler reduces the problem to a standard optimization formulation, and then solves it on an external solver. Then, the CoJava program is run as a Java program, where the choice statements select the found optimal values, and the assert and optimization statements are ignored. We illustrate the usage and semantics of CoJava using a simple supply-chain example, in which elastic demand, a manufacturer and a supplier are modeled as Java classes.


Constraint Programming Java Program Choice Statement Program Variable Execution Path 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Goldberg, A., Robson, D.: Smalltalk-80: the language and its implementation. Addison-Wesley Longman Publishing Co., Inc., Boston (1983)MATHGoogle Scholar
  2. 2.
    Gosling, J., Joy, B., Steele, G.: The Java language specication. Addison-Wesley Longman Publishing Co., Inc., Boston (1996)Google Scholar
  3. 3.
    Dahl, O.-J., Nygaard, K.: Simula: an algol-based simulation language. Commun. ACM 9, 671–678 (1966)MATHCrossRefGoogle Scholar
  4. 4.
    Thomasma, T., Madsen, J.: Object oriented programming languages for developing simulation-related software. In: WSC 1990: Proceedings of the 22nd conference on Winter simulation, Piscataway, NJ, USA, pp. 482–485. IEEE Press, Los Alamitos (1990)Google Scholar
  5. 5.
    Healy, K.J., Kilgore, R.A.: Introduction to silk and java-based simulation. In: WSC 1998: Proceedings of the 30th conference on Winter simulation, pp. 327–334. IEEE Computer Society Press, Los Alamitos (1998)Google Scholar
  6. 6.
    Bizarro, P., Silva, L.M., Silva, J.G.: Jwarp: A java library for parallel discrete-event simulations. In: Proceedings of the ACM Workshop on Java for High- Performance Network Computing, pp. 999–1005 (1998)Google Scholar
  7. 7.
    Fourer, R., Gay, D.M., Kernighan, B.W.: A modeling language for mathematical programming. Manage. Sci. 36, 519–554 (1990)MATHCrossRefGoogle Scholar
  8. 8.
    Boisvert, R.F., Howe, S.E., Kahaner, D.K.: Gams: a framework for the management of scientific software. ACM Trans. Math. Softw. 11, 313–355 (1985)MATHCrossRefGoogle Scholar
  9. 9.
    Van Hentenryck, P., Michel, L., Perron, L., Régin, J.C.: Constraint programming in opl. In: Nadathur, G. (ed.) PPDP 1999. LNCS, vol. 1702, pp. 98–116. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  10. 10.
    Jaffar, J., Lassez, J.-L.: Constraint logic programming. In: POPL 1987: Proceedings of the 14th ACM SIGACT-SIGPLAN symposium on Principles of programming languages, pp. 111–119. ACM Press, New York (1987)CrossRefGoogle Scholar
  11. 11.
    Caseau, Y., Josset, F.X., Laburthe, F.: CLAIRE: combining sets, search and rules to better express algorithms. Theory and Practice of Logic Programming 2, 769–805 (2002)MATHCrossRefMathSciNetGoogle Scholar
  12. 12.
    Smolka, G., Henz, M., Wurtz, J.: Object-oriented concurrent constraint programming in Oz. Principles and Practice of Constraint Programming, 29–48 (1995)Google Scholar
  13. 13.
    Wallace, M., Novello, S., Schimpf, J.: ECLiPSe: A platform for constraint logic programming. ICL Systems Journal 12, 159–200 (1997)Google Scholar
  14. 14.
    Puget, J.F., Leconte, M.: Beyond the glass box: Constraints as objects. In: International Logic Programming Symposium, pp. 513–527 (1995)Google Scholar
  15. 15.
    Apt, K., Schaerf, A.: Search and imperative programming. In: Conference Record of POPL 1997: The 24TH ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Paris, France, New York, NY, pp. 67–79 (1997)Google Scholar
  16. 16.
    Jayaraman, B., Tambay, P.: Semantics and applications of constrained objects. Technical Report 2001-15 (2001)Google Scholar
  17. 17.
    Horn, B.L.: Siri: a constrained-object language for reactive program implementation. School of Computer Science, Carnegie Mellon University, Pittsburgh (1991)Google Scholar
  18. 18.
    Puget, J.F.: A c++ implementation of clp. In: Proceedings of SPICIS (1994)Google Scholar
  19. 19.
    Laburthe, F.: Choco: Implementing a cp kernel. In: CP00 Post Conference Workshop on Techniques for Implementing Constraint programming Systems (TRICS), Singapore, pp. 71–85 (2000)Google Scholar
  20. 20.
    Schulte, C., Tack, G.R.: Views and iterators for generic constraint implementations. In: Hnich, B., Carlsson, M., Fages, F., Rossi, F. (eds.) CSCLP 2005. LNCS, vol. 3978, pp. 118–132. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  21. 21.
    Brodsky, A., Segal, V.E., Chen, J., Exarkhopoulo, P.A.: The ccube constraint object-oriented database system. Constraints 2, 245–277 (1997)MATHCrossRefGoogle Scholar
  22. 22.
    Borning, A.: The programming language aspects of thinglab, a constraint-oriented simulation laboratory. ACM Trans. Program. Lang. Syst. 3, 353–387 (1981)CrossRefGoogle Scholar
  23. 23.
    Freeman-Benson, B.N.: Kaleidoscope: mixing objects, constraints, and imperative programming. In: OOPSLA/ECOOP 1990: Proceedings of the European conference on object-oriented programming on Object-oriented programming systems, languages, and applications, pp. 77–88. ACM Press, New York (1990)CrossRefGoogle Scholar
  24. 24.
    Fritzson, P.A., Engelson, V.: Modelica - A unified object-oriented language for system modeling and simulation. In: Jul, E. (ed.) ECOOP 1998. LNCS, vol. 1445, pp. 67–90. Springer, Heidelberg (1998)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Alexander Brodsky
    • 1
    • 2
  • Hadon Nash
    • 3
  1. 1.George Mason UnviersityUSA
  2. 2.Adaptive Decisions, Inc.USA
  3. 3.GoogleUSA

Personalised recommendations