linear-programming

Resource with schedules allocation problem

烂漫一生 提交于 2020-08-26 09:34:07
问题 I have a similar to this task but with some differencies in bold. That is: I have a set of J jobs that need to be completed. Jobs are organized into set of directed graphs. Each job can have one or more preceding(parent) jobs that have to be completed before it starts All jobs take different times to complete, but the time is known I have a set of R human resources. Important!!! Each resource has a schedule when this resource is available Some jobs can be preempted once started. E.g. if a

Solving modular linear congruences for large numbers

徘徊边缘 提交于 2020-08-20 09:11:43
问题 I'm looking for a better algorithm than one I found on stackoverflow to handle 4096 byte numbers, i'm hitting a maximum recursion depth. Code from stackoverlow post, i copy/pasted it but lost the original link: def linear_congruence(a, b, m): if b == 0: return 0 if a < 0: a = -a b = -b b %= m while a > m: a -= m return (m * linear_congruence(m, -b, a) + b) // a This works fine for smaller numbers, for example: In [167]: pow_mod(8261, 63, 4033) 63 1 8261 4033 31 195 1728 4033 15 2221 1564 4033

Generator Expressions not working as expected in linear programming constraints with Pulp

折月煮酒 提交于 2020-07-23 07:39:24
问题 I am trying to solve this minimization problem with Pulp. We have packets of mangoes each having a category, age, and count of mangoes in it. # Packet Names and the count, category and age of mangoes in each packet. mango_packs = { "pack_1": { "count": 5, "category": "pack", "age": 10 }, "pack_2": { "count": 9, "category": "pack", "age": 10 }, "bag_2": { "count": 5, "category": "bag", "age": 20 }, "sack_1": { "count": 5, "category": "sack", "age": 5 }, } We will have demand for a number of

Generator Expressions not working as expected in linear programming constraints with Pulp

老子叫甜甜 提交于 2020-07-23 07:38:11
问题 I am trying to solve this minimization problem with Pulp. We have packets of mangoes each having a category, age, and count of mangoes in it. # Packet Names and the count, category and age of mangoes in each packet. mango_packs = { "pack_1": { "count": 5, "category": "pack", "age": 10 }, "pack_2": { "count": 9, "category": "pack", "age": 10 }, "bag_2": { "count": 5, "category": "bag", "age": 20 }, "sack_1": { "count": 5, "category": "sack", "age": 5 }, } We will have demand for a number of

Generator Expressions not working as expected in linear programming constraints with Pulp

谁说我不能喝 提交于 2020-07-23 07:37:06
问题 I am trying to solve this minimization problem with Pulp. We have packets of mangoes each having a category, age, and count of mangoes in it. # Packet Names and the count, category and age of mangoes in each packet. mango_packs = { "pack_1": { "count": 5, "category": "pack", "age": 10 }, "pack_2": { "count": 9, "category": "pack", "age": 10 }, "bag_2": { "count": 5, "category": "bag", "age": 20 }, "sack_1": { "count": 5, "category": "sack", "age": 5 }, } We will have demand for a number of

How to solve linear programming model in R

大兔子大兔子 提交于 2020-07-19 19:13:32
问题 I need to solve the following microeconomic problem: I have six assets I can produce (asset 1 - 6) across five years (2011 - 2015). Each asset can only be produced during one year. Each asset must be produced in my five year period. Production is not mutually exclusive; I can produce more than one good in a year without affecting the production of either. Each asset has a fixed cost of production equal to 30. I must have non-negative profit in each year; revenues must be at least 30. Below is

How to solve linear programming model in R

耗尽温柔 提交于 2020-07-19 19:10:11
问题 I need to solve the following microeconomic problem: I have six assets I can produce (asset 1 - 6) across five years (2011 - 2015). Each asset can only be produced during one year. Each asset must be produced in my five year period. Production is not mutually exclusive; I can produce more than one good in a year without affecting the production of either. Each asset has a fixed cost of production equal to 30. I must have non-negative profit in each year; revenues must be at least 30. Below is

unit commitment problem using piecewise-linear approximation become MIQP

橙三吉。 提交于 2020-06-17 12:56:18
问题 I try to use MILP (Mixed Integer Linear Programming) to calculate the unit commitment problem. (unit commitment: An optimization problem trying to find the best scheduling of generator) There are two optimization variables. Generator power : P (continuous variables). Which line segment on cost curve to use : BN (binary variable). ,Used to linearize the quadratic cost function of the generator. Only one line segment can be opened at a time. So there will be a Constraint. Bn1 + Bn2 + Bn3 <=1

Unable to run CPLEX on Pulp in Python

半世苍凉 提交于 2020-06-17 09:18:46
问题 I am trying to use Pulp to setup my LP model and solve it using CPLEX solver. I have CPLEX installed with license on my laptop but getting the below error : PulpSolverError: PuLP: cannot execute cplex.exe 回答1: Make sure that cplex.exe is in your PATH (see Adding directory to PATH Environment Variable in Windows). Alternately, you can set the path argument to the location of cplex.exe in the CPLEX_CMD constructor (see the source code). 来源: https://stackoverflow.com/questions/51275018/unable-to

block of consecutive variables to have same value in mixed-integer linear programming

匆匆过客 提交于 2020-06-16 07:08:20
问题 I am trying to model the operation of a system component, the component will have two operating modes, let's call them 1 and 2, plus the idle mode 0 There is no limit on idling, but each operating mode will last for exactly 3 time-series points, so x_{i}= 1 means x_{i+1} = x_{i+2} = 1 (cannot post images, please use the link below for the equation) operation mode 1 same goes for operating mode 2. For example. 011102220 is valid, but 01110220 is not. 111111 or 222222 are not valid, but this is