gurobi

Gurobi objective with python dictionary values

被刻印的时光 ゝ 提交于 2019-11-28 10:22:00
问题 I am using Gurobi 6.0 with Python 2.7. I am curious to know if Gurobi allows the objective function to have values coming from a dictionary with indices of the decision variables. Attaching the code: from gurobipy import * d = { (0, 0): 0, (0, 1): -5, (1, 0): 4, (1, 1): 2, (2, 0): 0, (0, 2): 10 } m = Model() x = m.addVar(vtype=GRB.INTEGER) y = m.addVar(vtype=GRB.INTEGER) m.update() m.addConstr(x + y <= 2) m.setObjective(d[(x, y)], GRB.MAXIMIZE) m.optimize() print m.objVal print x.x print y.x

Solving an integer linear program: why are solvers claiming a solvable instance is infeasible?

半城伤御伤魂 提交于 2019-11-27 09:15:58
I'm trying to solve integer programming problems. I've tried both use SCIP and LPSolve For example, given the final values of A and B, I want to solve for valA in the following C# code: Int32 a = 0, b = 0; a = a*-6 + b + 0x74FA - valA; b = b/3 + a + 0x81BE - valA; a = a*-6 + b + 0x74FA - valA; b = b/3 + a + 0x81BE - valA; // a == -86561, b == -32299 Which I implemented as this integer program in lp format (the truncating division causes a few complications): min: ; +valA >= 0; +valA < 92; remAA_sign >= 0; remAA_sign <= 1; remAA <= 2; remAA >= -2; remAA +2 remAA_sign >= 0; remAA +2 remAA_sign <

mathematical optimization library for Java — free or open source recommendations? [closed]

自作多情 提交于 2019-11-27 07:29:05
Does anyone know of such a library that performs mathematical optimization (linear programming, convex optimization, or more general types of problems)? I'm looking for something like MATLAB, but with the ability to handle larger problems. Do I have to write my own implementations, or buy one of those commercial products (CPLEX and the like)? A good answer is dependent on what you mean by "convex" and "more general" If you are trying to solve large or challenging linear or convex-quadratic optimization problems (especially with a discrete component to them), then it's hard to beat the main

Solving an integer linear program: why are solvers claiming a solvable instance is infeasible?

陌路散爱 提交于 2019-11-26 17:49:31
问题 I'm trying to solve integer programming problems. I've tried both use SCIP and LPSolve For example, given the final values of A and B, I want to solve for valA in the following C# code: Int32 a = 0, b = 0; a = a*-6 + b + 0x74FA - valA; b = b/3 + a + 0x81BE - valA; a = a*-6 + b + 0x74FA - valA; b = b/3 + a + 0x81BE - valA; // a == -86561, b == -32299 Which I implemented as this integer program in lp format (the truncating division causes a few complications): min: ; +valA >= 0; +valA < 92;

mathematical optimization library for Java — free or open source recommendations? [closed]

落爺英雄遲暮 提交于 2019-11-26 13:18:52
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . Does anyone know of such a library that performs mathematical optimization (linear programming, convex optimization, or more general