Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  does Extract limitation is exist?

    Posted 04/26/17 04:52 AM

    Originally posted by: Laser.Cho


    Hi. I'm using latest Cplex studio in windows 7.

     

    I tried a really simple code below for test. I expected 2 optimized solutions.(it has 2 solution) 

     

    ===============

    dvar float x;

    dexpr float res=(x+2)*(x-2)*(x+4)*(x-4);

    minimize 
        res;

    ===============

    The result is error.

    The only message I got is "CPLEX(default) cannot extract expression: (((x+2)*(x+(-2)))*(x+4))*(x+(-4)).

     

    I cannot understand why it happened. Quadratic equation is not surported? 

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: does Extract limitation is exist?

    Posted 04/26/17 05:13 AM

    Hi,

    when you deal with such non linear nor quadratic objective you could try Constraint Programming:

    using CP;
     
     int scale=1000000;
     
     dvar int scalex in -100*scale..100*scale;
     
     
     dexpr float x=scalex/scale;

    dexpr float res=(x+2)*(x-2)*(x+4)*(x-4);

    minimize
        res;
        
    subject to
    {

    }    
        
        
    execute
    {
    writeln(x);
    }   

    gives

    -3.167115

    regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: does Extract limitation is exist?

    Posted 04/26/17 05:21 AM

    Originally posted by: Laser.Cho


    I really appreciate you to answer my Question. thanx.

     

    now i know I have to learn CP programming. 

     

    Can you tell me why what I did is wrong? and is there way to show other optimal solutions if exist? 


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: does Extract limitation is exist?

    Posted 04/26/17 07:41 AM

    Hi,

    even without CP you could have written

    dvar float x2; //x2=x*x
    dexpr float res=(x2-4)*(x2-16);

    minimize
            res;
            
        subject to
        {

        }    
            
            
    execute
        {
        writeln(Opl.sqrt(x2));
        }  

    and then you get

    3.16227766

    regards


    #CPLEXOptimizers
    #DecisionOptimization