12.07.2015 Views

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Specifying PreferencesYou specify the bounds or ranges that FeasOpt may consider for modification by assigningpositive preferences for each. A negative or zero preference means that the associated boundor range is not to be modified. One way to construct a weighted penalty function from thesepreferences is like this:∑vi ⁄ p i where v i is the violation and p i is the preference.Thus, the larger the preference, the more likely it will be that a given bound or range will bemodified. However, it is not necessary to specify a unique preference for each bound orrange. In fact, it is conventional to use only the values 0 (zero) and 1 (one) except when yourknowledge of the problem suggests assigning explicit preferences.Example: FeasOpt in Concert TechnologyThe following examples show you how to use FeasOpt. These fragments of code are writtenin Concert Technology for C++ users, but the same principles apply to the other APIs aswell. The examples begin with a model similar to one that you have seen repeatedly in thismanual.IloEnv env;try {IloModel model(env);IloNumVarArray x(env);IloRangeArray con(env);IloNumArray vals(env);IloNumArray infeas(env);x.add(IloNumVar(env, 0.0, 40.0));x.add(IloNumVar(env));x.add(IloNumVar(env));model.add(IloMaximize(env, x[0] + 2 * x[1] + 3 * x[2]));con.add( - x[0] + x[1] + x[2]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!