Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  In Linux CPLEX, after optimize, how to just write variables into a file?

    Posted 01/12/11 12:32 AM

    Originally posted by: xilinx_zhao


    In Linux CPLEX, after command of "optimize", how to just write variables as a vector into a file? I need to use C program to read the value of variables and then do some other calculation. I knew the command "display" can display them, but my problem has millions of variables and I need to output them into a file.
    Thank you.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: In Linux CPLEX, after optimize, how to just write variables into a file?

    Posted 01/13/11 10:54 PM

    Originally posted by: xilinxzhao


    Why can not I re-login my account? So I register another account to post.
    For this question, I mean, after "Optimize" excution, the CPLEX returns a solution. Yes, I care about that solution. But I also want to find out the value of variables on the occasion. For example :

    Mininize Y
    So that :
    x1+3*x2+x3+Y<3
    2*x1+x2+4*x3+Y<9
    x1,x2,x3>0

    So beside the optimal Y, I also want to find out the value of x1, x2 and x3 when I get minimum Y. And is there any way to print out x1,x2,x3 as a vector into a txt file?
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: In Linux CPLEX, after optimize, how to just write variables into a file?

    Posted 01/17/11 12:17 PM

    Originally posted by: SystemAdmin


    Hi,

    did you look at IloOplOutputFile?
    After your constraints block, you would need to define a script to write the output you want:
    execute {
      var of = new IloOplOutputFile("myResult.txt");
      of.writeln("Y=",Y);
      of.write("[x1,x2,x3] = [",x1,",",x2,",",x3,"]");
      of.close();
    }
    


    The content of the text file would then look like:
    Y=0
    [x1,x2,x3] = [1,0,1]
    

    #DecisionOptimization
    #OPLusingCPLEXOptimizer