Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Constraint Programming +NN in CP optimizer

    Posted Fri February 12, 2016 07:14 PM

    Originally posted by: FiFila


    Hi;

    I want to model by CP optimizer and NN a problem (I want to improve the NN by combination of it with constraint programming). As the input of NN is not linear, I can not use CPLEX, I have force to use a CP optimizer. Because I am in primary steps of learning a CP optimizer, would you please send me a sample or reference to see how I can model some constraints by CP optimizer as  a nonlinear input of  my NN.

     

     

    Another question: Is it possible to write the neural network section in Matlab and its constraints section in CPLEX?

    Thanks


    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: Constraint Programming +NN in CP optimizer

    Posted Sat February 13, 2016 08:27 AM

    Hi,

    about float expressions in CPO have a look at the example floatexpr.

    About calling CPLEX from MATLAB you may have a look at

    http://www-01.ibm.com/support/docview.wss?uid=swg21399987

    regards


    #CPOptimizer
    #DecisionOptimization


  • 3.  Re: Constraint Programming +NN in CP optimizer

    Posted Sat February 13, 2016 05:26 PM

    Originally posted by: FiFila


    Hi Alex;

    Thanks for your help but I want to use real amount (tanh). Have you any idea?

     

    Regards

    Fila


    #CPOptimizer
    #DecisionOptimization


  • 4.  Re: Constraint Programming +NN in CP optimizer

    Posted Mon February 15, 2016 03:09 PM

    Originally posted by: FiFila


    Hi;

     

    As I know we are be able to have some constraint  for real number like "e" in CP optimizer but I do not know how I can do it. Alex gave me a guidance to take a look at floatexpr.

    Thank you  but as I have seen the example of floatexpr it is related to p/q (p and q are integer) but I want to work with some other types of input like "e" which I am not be able to use this method. Does any one have an idea about it? 

    Regards

    Fila


    #CPOptimizer
    #DecisionOptimization


  • 5.  Re: Constraint Programming +NN in CP optimizer

    Posted Thu February 18, 2016 10:45 AM

    Originally posted by: ol


    Hello

    you can use one of the two kinds of formulations below. The first one is represented as a floating point, so it is not the exact value of e. The second one is represented as an interval that is guaranted to contain the real value.

    Regards,

    Olivier

     

    IloNumExpr e=IloNumExpr(env,2.718);

    IloNumExpr e=IloExponent(IloNumExpr(env,1.0));


    #CPOptimizer
    #DecisionOptimization


  • 6.  Re: Constraint Programming +NN in CP optimizer

    Posted Sun February 28, 2016 11:53 AM

    Originally posted by: FiFila


    Thanks Olivier;

    But I really want to calculate the tanh(X)? What about your idea?


    #CPOptimizer
    #DecisionOptimization


  • 7.  Re: Constraint Programming +NN in CP optimizer

    Posted Mon February 29, 2016 04:52 AM

    Originally posted by: Petr Vilím


    Hello FiFila,

    tanh can be computed as ( exp(2*x) - 1 )  / ( exp(2*x) + 1 ).

    However it will probably not propagate very well because x is used twice in the expression (that's something better to avoid in CP).

    I would first try this expression. Then, if necessary, you may try to approximate tanh by a piecewise linear function. Or you can write your own constraint (in C++).

    Petr


    #CPOptimizer
    #DecisionOptimization


  • 8.  Re: Constraint Programming +NN in CP optimizer

    Posted Mon February 29, 2016 09:14 AM

    Originally posted by: FiFila


    Hi Petr;

    Thanks for your great help.

    Because I have for instance two layers in NN (two layer with tanh), I think this computation encounters more fault. Do you have any idea?

    Best

    Fila


    #CPOptimizer
    #DecisionOptimization


  • 9.  Re: Constraint Programming +NN in CP optimizer

    Posted Mon February 29, 2016 10:09 AM

    Originally posted by: Petr Vilím


    What do you mean by "more fault"? Less precise result? The computation is done internally in "double" type, so it should be quite precise. Do you have a specific example where it behaves badly?

    Best, Petr


    #CPOptimizer
    #DecisionOptimization


  • 10.  Re: Constraint Programming +NN in CP optimizer

    Posted Mon February 29, 2016 10:59 AM

    Originally posted by: FiFila


    Thanks Petr;

    Yes, Less precise I mean. No, I have not written my code but I think because of properties of NN  it may be with less precise. Because we multiple tanh several times in input of each layer. This is the reason I have doubt to is CP or CPLEX a good environment to implementation (If yes, how I can reduce the error because of this estimation) or I should switch to others like or-tools, etc?


    #CPOptimizer
    #DecisionOptimization


  • 11.  Re: Constraint Programming +NN in CP optimizer

    Posted Mon February 29, 2016 11:24 AM

    Originally posted by: Petr Vilím


    We care about precision of the computation a lot, the error using exp function should be really minimal (maybe one or two last digits of the sixteen digit mantissa). You can easily try and is it for yourself.

    Best, Petr


    #CPOptimizer
    #DecisionOptimization