Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Write only the specified variables to a .sol file

    Posted 09/20/17 05:57 AM

    Originally posted by: story_


    Hi,

    I was wondering if there is a way to write only specified variables (where some are discrete and some are not) to a .sol file using writeMIPStarts in Java API.

    Thanks.


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Write only the specified variables to a .sol file

    Posted 09/20/17 06:04 AM

    Hi

    The level of detail to write to the file is controlled by setting the IloCplex.IntParam.WriteLevel parameter.

    Values of this enumeration specify how much detail CPLEX includes when it writes MIP starts and solutions to a formatted file.

    Auto = CPX_WRITELEVEL_AUTO   
    AllVars = CPX_WRITELEVEL_ALLVARS   
    DiscreteVars = CPX_WRITELEVEL_DISCRETEVARS   
    NonzeroVars = CPX_WRITELEVEL_NONZEROVARS   
    NonZeroDiscreteVars = CPX_WRITELEVEL_NONZERODISCRETEVARS

    regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Write only the specified variables to a .sol file

    Posted 09/20/17 06:11 AM

    So the answer to the question is "no".

    However, it is easy to just write a .sol file yourself and include only the desired variables. A specification of the solution file format can be found in cplex/include/ilcplex/solution.xsd.


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Write only the specified variables to a .sol file

    Posted 09/20/17 06:13 AM

    Originally posted by: story_


    Hi,

    Thank you for your response. 

    I am wanting to write a subset of all variables, where only some of them are discrete. For instance, if we have the integer variables a,b,c, and d,e as continuous variables, I would like the .sol file to have a,b (discrete) and d (continuous).

    The only method I could think of so far is to write all variables (using the write level 1), and remove other unwanted variables manually. But this probably will cause the .sol file to become very large (as I have over 50k variables) and I am not sure if it would be the most efficient way.


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Write only the specified variables to a .sol file

    Posted 09/26/17 03:40 AM

    Like I said, the easiest is to just explicitly write the .sol file from your code instead of using a CPLEX function that creates the file for you. Using an existing (small) .sol file it should be simple to write such a file from your program.


    #CPLEXOptimizers
    #DecisionOptimization