Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

Stop CPLEX and print the last integer feasible solution

  • 1.  Stop CPLEX and print the last integer feasible solution

    Posted 12/13/18 09:56 AM

    Originally posted by: 88Simon88


    Hello everybody,

    I have two questions:

    1- I run the model and then stop the CPLEX. I use the interactive scripting to get the solution, but it doesn't show me the whole values for the decision variables as you can find in the below picture. Why? can I use the interactive scripting to print all results in text or excel file and the rerun the model?

     

    2- How can I extract only the integer feasible solutions both in interactive scripting and in the main block?

     

    Thanks


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Stop CPLEX and print the last integer feasible solution

    Posted 12/13/18 10:17 AM

    Hi

    1)

    You may use below

    2)

    In the main block you may use write or even write to a text file

    regards

     

     


    #DecisionOptimization


  • 3.  Re: Stop CPLEX and print the last integer feasible solution

    Posted 12/13/18 10:57 AM

    Originally posted by: 88Simon88


    Hi,

    No, it doesn't work. You have written "write(Open)" and Open is your decision variable and maybe it is not that much big, but my decision variable is big and the CPLEX shows with ... . 

    How can I print the solution in a text file with scripting like a matrix? I use this code but it prints each value of the decision variable in one row. Can I use tab or space? 

    thank you.


    #DecisionOptimization


  • 4.  Re: Stop CPLEX and print the last integer feasible solution

    Posted 12/13/18 01:24 PM

    Hi,

    let me give you an example

     

    generates exp.txt

     [1 1 0 1 1 0 1 1 1 0 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1
         1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1
         1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1
         0 1 1 0 1 1 0 1 1 0 1 1 0 0 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1
         1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0
         1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1]

     

    regards


    #DecisionOptimization


  • 5.  Re: Stop CPLEX and print the last integer feasible solution

    Posted 12/13/18 01:32 PM

    Originally posted by: 88Simon88


    Thank you Alex, You are perfect.


    #CPLEXOptimizers
    #DecisionOptimization