Skip to main content

Signomial terms in objective function

Answered

Comments

6 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?.
  • Alison Cozad
    • Gurobi Staff

    Optimization solvers are often classified by the functional forms they can handle (also the variable types, but that's less relevant here).  Some solvers can only solve linear problems, some can do certain nonlinear functions, and some can solve with most or all nonlinear functions.  Gurobi, for example, can solve models with linear, bilinear, and quadratic functions. 

    You are likely getting this error from YALMIP because Gurobi cannot directly solve models with nonlinear functions other than quadratic or bilinear.  Therefore, Gurobi can handle EXP values of 0, 1, and 2.

    However, you have a few options to solve your problem when EXP is at or above 3:

    1. Use on of YALMIPs nonlinear solvers.  See YALMIP's Solvers >   
    2. Create a piecewise linear approximation for your other functional forms.  Luckily, Gurobi can help you create piecewise linear objectives and constraints.
    3. Depending on your value of EXP, you may be able to create auxiliary variables as described in How do I model multilinear terms in Gurobi?  For example, say I wanted to set \(z = x^3\) in my model. Since this constraint has a third-degree polynomial, I cannot solve it directly with Gurobi.  Instead, I can create a new auxiliary variable \(y = x^2\). Then, I can set \(z = y\cdot x\).  Now, I have two constraints with only linear, quadratic, and bilinear terms — so Gurobi can solve it!

     

    Assuming EXP is known (it is not another variable), I am seeing that when EXP > 2 there is no problem but for 0 <= EXP < 2 I am obtaining the following errror: ...

    That said, I want to clarify a point here.  Are you saying that you get this YALMIP error when EXP = 0, 1, and 2?  Or that there is no problem when EXP = 0, 1, 2?

    1
  • Roger Creus
    • Gurobi-versary
    • First Question
    • First Comment

    Thank you very much for answering! When I try EXP = 0,1,2 there is no problem at all. The thing is that I am interested in EXP = 0.2 actually. So if the solution in this case is creating piecewise linear approximations, should I switch to python? (as I don't see the implementation of these functions in matlab and less in the YALMIP framework). Thank you very much!

    0
  • Alison Cozad
    • Gurobi Staff

    Good news, you can do this directly through the Gurobi Matlab interface.  I am less familiar with YALMIP and whether or not this feature is implemented in YALMIP.

    For the Gurobi Matlab interface, you can find details about the piecewise-linear objective (model.pwlobj) and constraints (genconpwl) in the the model argument documentation.  Additionally, here are links to piecewise-linear examples that may help:

    Also, if you want more details, check out the full Gurobi Matlab interface documentation.

    1
  • Roger Creus
    • Gurobi-versary
    • First Question
    • First Comment

    Alright! All these resources were very helpful, thank you! One last question: For the piecewise function, the set of points can always be between 0-1 (i.e. u = linspace(0.0, 1.0, 101))?. Is this always correct?

     

    0
  • Matthias Miltenberger
    • Gurobi Staff

    Hi Roger,

    No, the intervals of points for the piecewise-linear constraints are arbitrary and don't have to be \(\left[0, 1\right]\).

    Cheers,
    Matthias

    1

Post is closed for comments.