Cookie Settings
Customize Consent Preferences
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

Other cookies are those that are being identified and have not been classified into any category as yet.

Try our new documentation site (beta).

Filter Content By
Version
Table of contents
Filter by Language
C API Details
C++ API Details
GRBModel +
Java API Details
GRBModel +
.NET API Details
GRBModel +
Python API Details
Model +
Attributes
Parameters
Parameter Descriptions +


GRBModel::addGenConstrLog()

Add a new general constraint of type GRB_GENCONSTR_LOG to a model.

A natural logarithmic function constraint states that the relationship <span>$</span>y = log(x)<span>$</span> should hold for variables <span>$</span>x<span>$</span> and <span>$</span>y<span>$</span>.

A piecewise-linear approximation of the function is added to the model. The details of the approximation are controlled using the following four attributes (or using the parameters with the same names): FuncPieces, FuncPieceError, FuncPiecesLength, and FuncPieceRatio. For details, consult the General Constraint discussion.

GRBGenConstr addGenConstrLog ( GRBVar xvar,
    GRBVar yvar,
    std::string name="",
    std::string options="" )
    Arguments:

    xvar: The <span>$</span>x<span>$</span> variable.

    yvar: The <span>$</span>y<span>$</span> variable.

    name (optional): Name for the new general constraint.

    options (optional): A string that can be used to set the attributes that control the piecewise-linear approximation of this function constraint. To assign a value to an attribute, follow the attribute name with an equal sign and the desired value (with no spaces). Assignments for different attributes should be separated by spaces (e.g. "FuncPieces=-1 FuncPieceError=0.001").

    Return value:

    New general constraint.