Skip to main content

Solving a problem with a neural network constraint

Awaiting user input

Comments

1 comment

  • Pierre Bonami
    Gurobi Staff Gurobi Staff

    Hi Othmane,

    Thanks for your question. It's hard to say why it is very slow. Some models with neural network can indeed be very slow and sometimes it is very hard to find a feasible solution.

    If you can share the model, it would be easier to have a look.

    I had a look at your python code though and the first think that comes to my mind is that it would probably be more efficient to try to formulate the polynomial of true_function directly in Gurobi.

    Gurobi can model products of variable and by creating additional variables you could directly model the polynomial in `true_function` What I mean is you can create a variable y = x*x, then to get x^3 you create a variable z=x*y,...

    This can introduce some approximation but I think it would be much smaller than the one of the neural network and the model would be more compact.

     

    Best regards,

    Pierre

     

     

    0

Please sign in to leave a comment.