linear-programming

What is the run time complexity of integer linear programming (ILP)?

一笑奈何 提交于 2019-12-12 13:07:16
问题 What is the run time complexity of integer linear programming (ILP) problem when, there are N number of variables and R number of constraints? For coding purpose I am using Matlab's intlinprog function. Any reference would be helpful. 回答1: Integer programming is NP-Complete as mentioned in this link. Some heuristic methods used in the intlinprog function in Matlab (such as defining min and max value to limit the search space), but they can't change the complexity of the problem at all. Also,

how to represent being minimum spanning tree in linear programming constrains?

女生的网名这么多〃 提交于 2019-12-12 05:27:13
问题 suppose we are given a weighted graph G and a spanning tree T of it.we want to change weights of edges so that T be a minimum spanning tree and sum of all |w_i - w'_i| be minimum where w_i is the weight of edge i_th and w'_i is the weight of edge i_th after changing it. I think it's obvious our goal is to minimize sum of |w_i - w'_i| for all i and our variables are w'_i but i can't find how to represent T is minimum spanning tree in constrains. 回答1: For each i such that the i th edge is not

Getting all solutions in Google or-tools

眉间皱痕 提交于 2019-12-12 03:37:34
问题 I have a linear problem of finding all solutions that meet all constraints. For example my variables are = [0.323, 0.123, 1.32, 6.3...] Is it possible to get for example top 100 solutions sorted by fitness(maximization/minimization) function? 回答1: In a continuous LP enumerating different solutions is a difficult concept. E.g. consider max x, s.t. x <= 1 . Obviously x=1 , x=0.99999 are solutions and so are the infinite number of solutions in between. We could enumerate "corner solutions" (or

setting variables to a value using linear programming in r

折月煮酒 提交于 2019-12-12 03:23:14
问题 I have developed a linear programming model in R and I would like to know the command to set a variable to a value, here is my code and the results: install.packages("lpSolveAPI") library(lpSolveAPI) #want to solve for 6 variables, these correspond to the number of bins lprec <- make.lp(0, 6) lp.control(lprec, sense="max") #MODEL 1 set.objfn(lprec, c(13.8, 70.52,122.31,174.73,223.49,260.65)) add.constraint(lprec, c(13.8, 70.52, 122.31, 174.73, 223.49, 260.65), "=", 204600) add.constraint

conditional constraint in optimization

夙愿已清 提交于 2019-12-12 00:04:22
问题 Does anybody know how to write conditional constraint in mixed integer programming for this case: if a == 0 then b = 1 else b = 0 -M <= a <= M b={0,1} Note that M can be any continuous number. Thanks. Regards, 回答1: I would approach this as follows. First use a variable splitting approach by introducing two non-negative variables aplus, amin : 0 <= aplus <= d*M 0 <= amin <= (1-d)*M a = aplus-amin d in {0,1} Now we can do: 0.001*(1-b) <= aplus + amin <= M*(1-b) In many cases we can simplify

How can I avoid having two instances of a very large matrix at the same time when loading it into a solver?

[亡魂溺海] 提交于 2019-12-11 23:09:26
问题 I am using both Cplex and Gurobi for an LP program whose inequality constraint matrix A can become truly large -- around 5 to 10GB. When I want to use one of those solvers, I have to create a separate struct with all the problem constraints. This means that I have the matrix A in my workspace, and the matrix A in my solver struct at the same time. Even if I clear it in my Workspace as fast as possible, there is still a time when both exist and my RAM is overloaded. I am asking if there is

Algorithm that can turn a linear programming problem to a feasible one

那年仲夏 提交于 2019-12-11 20:31:39
问题 I need an algorithm that automatically makes a linear programming problem feasible. Concretely, the algorithm is such that its input is a linear programming problem which potentially does not have feasible solutions, and its output is a similar programming (with parameters modified with minimum) which is bound to have feasible solutions. I am a newbie in algorithms and inquire if there is any existing research/work for such problems? Any suggestions and comments are appreciated. Thanks,

Define CVXPY variables for graph coloring problem

血红的双手。 提交于 2019-12-11 17:23:07
问题 I’m trying to solve the minimum graph coloring problem. I’m trying to solve it as an mip using cvxpy. I’m following the outline of a solution described in this url: https://manas.tech/blog/2010/09/16/modelling-graph-coloring-with-integer-linear-programming.html I’m not sure if I’m understanding how the cvxpy variables are created correctly, and how I’m defining my constraints. I have sample input data below along with the code creating the variables, constraints, and objective function,

Solution not Feasible in Linear Programming in Python Gurobi

自闭症网瘾萝莉.ら 提交于 2019-12-11 14:58:50
问题 This is continuation of this thread. I am coding MILP using Gurobi in Python where the objective is to maximize the rewards while ensuring the distance constraint is not violated. I am however getting solution is infeasible. I tried the IIS but it still didnt help because it only shows the constraint that is being violated but not the solution. import random import gurobipy as grb import math n = 4 Distance = 50000000 def distance(points, i, j): dx = points[i][0] - points[j][0] dy = points[i]

Goal Programming in Cplex

核能气质少年 提交于 2019-12-11 13:22:50
问题 Let's say I have the two goals. I want to reach that goals really close: i=1) profit goal: 12𝑥 + 9y ≥ 125 i=2) cost-goal: 5𝑥 + 7y ≤ 50 In the literature you can do goal-programming by inserting variables, which represent deviations. Let's say the variable ai is the deviation above the goal value from goal I and bi is the deviation below the goal value from goal I. You get the following constraints: 12𝑥 + 9y -a1 + b1 = 125 5𝑥 + 7y -a2 + b2 = 50 In the last step you create the objective