Forum Discussion
FICO
3 years agoCommunity Manager
How to use chgmcoef or similar functions to change constraints coefficients with indexed dictionary
Hello Xpress experts! I would appreciate if you could help me figure out the following question. Thanks in advance! I have a dummy problem with both variables and constraints defined in dictionary s...
FICO
3 years agoCommunity Manager
As you can see in the documentation, function chgmcoef()required arguments to be arrays, so dictionaries won't work. I can see two ways to write your code with a single call to chgmcoef():
mdl.chgmcoef([c1[m,t] for m,t in c1],
[y[m,t] for m,t in c1],
[p2[m,t] for m,t in c1])or
zipped = [(c1[m,t], y[m,t], p2[m,t]) for m,t in c1]
rowind, colind, rowcoef = zip(*zipped)
mdl.chgmcoef(rowind, colind, rowcoef)Related Content
Related Content
Changing objective function coefficient
Given the following overly simplified code snippet. XPRBprob bprob = bcl.newProb(); //.. XPRBexpr obj = new XPRBexpr(); //Define some objective //.. bprob.setSense(XPRB.MAXIM); bprob.setObj(obj); /...5 years agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum1 unread comment1 unread10Views0likes1Commentpython API Question : dictionary with tuple keys and xpress variables
I'm trying to convert gurobi to xpress does xpress python api has data object like tupledict in gurobi? I want to select the variables specified by the designated index in tuple key... Or any othe...3 years agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum1 unread comment1 unread3Views0likes1CommentXpress range constraint
Using the latest Xpress interface I can add a constraint x_i + y_i <= UB_i for all i like this: xprsProb.addConstraints(nrNodes, i -> sum(x+y).leq(UB)); How can I add a range constraint like: LB_i...1 year agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum1 unread comment1 unread4Views0likes1Comment