linear-programming

R: Simplex error: NAs are not allowed in subscripted assignments

一笑奈何 提交于 2020-01-04 18:01:52
问题 For the following minimization with objective function and constraints, boot.simplex returns an error: Error in tab[-pr, ] <- tab[-pr, ] - (tab[-pr, pc]/pv) %o% tab[pr, ] : NAs are not allowed in subscripted assignments The code is here: library(boot) a = c(1, 1, 1) A2 = rbind(c(2, 7.5, 3), c(20, 5, 10)) b2 = c(10000, 30000) simplex(a=a, A2=A2, b2=b2, maxi=FALSE) Note that the constraints are only of the greater-than-equal-to type. But, if a bogus less-than-or-equal-to constraint is added as

Minimizing the sum of 3 variables subject to equality and integrality constraints

孤者浪人 提交于 2020-01-04 04:04:09
问题 I am working on a programming (using Python) problem where I have to solve the following type of linear equation in 3 variables: x, y, z are all integers. Equation example: 2x + 5y + 8z = 14 Condition: Minimize x + y + z I have been trying to search for an algorithm for finding a solution to this, in an optimum way. If anybody has any idea please guide me through algorithm or code-sources. I am just curious, what can be done if this problem is extrapolated to n variables? I don't want to use

Mixed integer programming: variable assignment per condition (if then else)

不想你离开。 提交于 2020-01-03 05:20:10
问题 I am relatively new to (mixed) integer programming and got stuck with the formulation of a constraint. In my simplified model I have one Parameter and two Variables that are positive Reals having the value 321 as upper bound. The logic I want to express is here: if Parameter > Variable1: Variable2 = Variable1 else: Variable2 = Parameter **edit** (while Variable1 is always >= Variable2) Is it actually possible to describe this using linear in(equalities)? If it helps: For the implementation I

How to save result of R script in Power BI

こ雲淡風輕ζ 提交于 2019-12-30 11:08:50
问题 Is it possible to implement the following scenario in Power BI Desktop? Load data from Excel file to several tables Make calculation with R script from several data sources Store results of calculation to new table in Power BI (.pbix) The idea is to use Power BI Desktop for solving "transportation problem" with linear programming in R. Before solver will be running we need to make data transformations from several data sources. I'm new in Power BI. I see that it is possible to apply R scripts

How to save result of R script in Power BI

冷暖自知 提交于 2019-12-30 11:08:22
问题 Is it possible to implement the following scenario in Power BI Desktop? Load data from Excel file to several tables Make calculation with R script from several data sources Store results of calculation to new table in Power BI (.pbix) The idea is to use Power BI Desktop for solving "transportation problem" with linear programming in R. Before solver will be running we need to make data transformations from several data sources. I'm new in Power BI. I see that it is possible to apply R scripts

PuLP very slow when adding many constraints

牧云@^-^@ 提交于 2019-12-30 03:27:04
问题 I'm trying to use PuLP, but it is taking 50 seconds to add 4000 constraints (with 67 variables). Solving the problem only takes a fraction of a second. We want to use PuLP to easily test several solvers on a large set of problems. Should it be taking PuLP this long? Using PyGLPK directly takes only a fraction of second including both setup and solving, so I hope not. What can I do to improve the efficiency of this step in PuLP? Update My constraints matrix is very sparse, and I was able to

Good linear programming library for C#? [closed]

亡梦爱人 提交于 2019-12-29 08:36:31
问题 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 . I'm looking for a linear programming solver for C#. In the other words I'm looking for a library for C# that solves linear programming

Linear Programming with cvxpy

戏子无情 提交于 2019-12-25 20:05:53
问题 I would like to ask you regarding on the Linear Program for optimization. I have an objective function, and constraint functions as below, variables(x1, x2, x3, x4, x5, x6) are quantities of the products, and the quantities of products have to be fixed numbers now. the goal of this problem is the optimizing the quantities of products. Objective Function (c.T * [x1, x2, x3, x4, x5, x6]) [[c11, c12, c13, c14, c15 c16], [c21, c22, c23, c24, c25, c26], X [x1, x2, x3, x4, x5, x6] [c31, c32, c33,

How to formulate x != y in lpsolve?

☆樱花仙子☆ 提交于 2019-12-25 14:13:39
问题 I'm trying to formulate that the variables x,y,z must all be different and that they accept only the values 1, 2 or 3 (this is, of course, a toy example): min: x+y+z; 1 <= x <= 3; 1 <= y <= 3; 1 <= z <= 3; but to make this work I still need either access to boolean operators or to a != operator, which don't seem to exist in lpsolve! How can I go about this? I wanted to do this: x != y; x != z; y != z; Thanks EDIT: Here's my current code: /* Objective function */ min: 1; /* Variable bounds */

Google OR-Tools : Solution unable to converge for Assignment with Task Sizes using python

£可爱£侵袭症+ 提交于 2019-12-25 01:22:28
问题 I tried to elaborate on the Assignment with Task Sizes example by adding a multi-dimensional "size"(demand) and "total_size_max" . The solution seems to decide to allocate everything to 1 worker only despite the fact that others are available. The result when run allocates everything to worker(machine 18). Sample output : Machine 18 is assigned to produce Component 0 with minimum Cycle_Time = 10000000 Machine 18 is assigned to produce Component 1 with minimum Cycle_Time = 10000000 Machine 18