Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  IloCplex Java object not fully Serializable?

    Posted 02/06/18 11:46 AM

    Originally posted by: Kevin Pauli


    I see that IloCplex implements java.io.Serializable (see https://www.ibm.com/support/knowledgecenter/en/SSSA5P_12.7.1/ilog.odms.cplex.help/refjavacplex/html/ilog/cplex/IloCplex.html )

     

    However when I attempt to serialize a model like so:

     

    IloCplex cplex = new IloCplex();
    ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("model.ser"));
    out.writeObject(cplex);
    out.close()

     

    It fails with:

     

    Exception in thread "main" java.io.NotSerializableException: ilog.concert.IloCopyManager
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
    at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)

     

    Why go to the trouble to make something serializable if all the objects in the graph are not serializable?  Did this used to work in previous versions?  Is it a bug?  This is happening with CPLEX 12.7.1


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: IloCplex Java object not fully Serializable?

    Posted 02/06/18 12:12 PM

    Class IloCplex is indeed not designed for serialization. It is marked serializable because it inherits from the serializable class IloCplexModeler. The IloCplexModeler class is perfectly serializable which is shown in the CplexServer.java example shipped with CPLEX.

     


    #CPLEXOptimizers
    #DecisionOptimization