Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Java shallow copy of IloCplex object

    Posted 02/16/12 01:33 PM

    Originally posted by: JamieKang


    Hello,

    Is there any way to shallow copy IloCplex object in Java?

    For example, I have IloCplex model1: max (x1+x2) s.t x1+x2<=2.
    Then, I want to add more constraints to it in model2: max (x1+x2) s.t (x1+x2<=2 and 2x1+x2<=5), while still keeping model1 as it is, because later on I want to build another model from that.

    Or, is there any way to copy all constraints from model1 and add to model2? I do not really care about objective function at this point.

    Any help would be appreciated.

    Thank you,

    Jamie
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Java shallow copy of IloCplex object

    Posted 02/16/12 02:01 PM

    Originally posted by: SystemAdmin


    I think what you describe is creating a deep copy, isn't it?
    What could help you is the CplexServer.java example that is in the collection of examples distributed with CPLEX. It shows how to serialize a model to an ObjectOutputStream. You could serialize your model to a file and then reload it every time you need it. Does that work for you?
    #CPLEXOptimizers
    #DecisionOptimization