322 questions
2
votes
3
answers
124
views
Problem with a Lineup Optimizer due to players having multiple Positions
i have a list of Hitters in python with their name,projection and Positions
juan-soto 30.3773 ['OF']
kyle-tucker 44.0626 ['OF']
...
yordan-alvarez 32.510200000000005 ['CI', 'OF']
william-contreras 26....
0
votes
1
answer
141
views
Limit Coin-OR CLP variables to integers
I've created a small program using the java clp implementation https://github.com/quantego/clp-java.
Sometimes the solution returns decimals, which I don't want as the variables that I'm using are ...
-1
votes
2
answers
67
views
PuLP: Constrain the number of distinct people that can work on a task
I have a LP/IP problem that I'm trying to solve using PuLP. It is the division of work amongst employees. The thing that I can't figure out is how to limit the engine to only plan 1 employee on an ...
0
votes
1
answer
110
views
Binary and Integer Program in Python
I have a binary/integer program that I am trying to solve using milp in Python. Below the image and below is the code I have so far. When I run it, I get
`bounds.lb` and `bounds.ub` must contain ...
1
vote
1
answer
92
views
Stuck formulating an adjacency constraint with pyomo
I'm trying to assign attributes into a 3 x 3 matrix based on an adjacency constraint, but I'm stuck formulating the adjacency constraint. I keep thinking I've got the answer, then when I try it the ...
2
votes
1
answer
119
views
Does the Order of Modeling Affect Computational Speed in Pulp for Integer Programming Problems?
I am currently solving an integer programming problem using Pulp. I am aware that the order of statements in Pulp modeling can affect the outcome of the computations. However, I am curious to know if ...
0
votes
1
answer
139
views
PAO.Pyomo model sets two variables x and y to be unique
The background is I am trying to implement a bilevel optimization program using Python-based package for Adversarial Optimization (PAO), which is based on Pyomo. I am new to Pyomo, though I have used ...
0
votes
1
answer
135
views
Keeping count of variable occurence in google OR Tools
I'm playing around with OR Tools, just wondering if there is any way to hold the number of times a certain constraint is satisfied?
In this case, I'd like to keep track of the number of times my 'diff'...
0
votes
1
answer
201
views
How to convert the following if-else conditions to Linear integer programming constraints?
if x ≥ 100,
then x -100 + p(x) ≤ 0;
else p(x) ≤ 0
p(x) is a linear function. We can add x ≥ 0 if it could make it easy.
I tried to make a binary variable z, if x ≥ 100, then z=1; else z=0. Then we got ...
2
votes
1
answer
86
views
setting a lower bound constraint based on condition in gekko
I am trying to set up something similar to the facility location problem using gekko in python. I'm trying to minimize the distance between a set of facilities and corresponding counties while ...
0
votes
1
answer
105
views
Binary Integer Programming Problem - Enforce Zeros on Certain Groups
I'm working on a binary integer programming problem using pulp. I have a vector X = [x_1, x_2, x_3, . . . , x_n]. I have enforced a number of simple constraints. I have a bunch of groups in the data ...
2
votes
2
answers
109
views
Linear integer programming in R?
I have a vector of 100 integers, x1, where each element of the vector is in [1, 7]. I want to find, using R, another vector of 100 elements, x2, also containing integers ranging from 1 to 7, that ...
0
votes
2
answers
727
views
Python-MIP InterfacingError('Gurobi environment could not be loaded, check your license.')
I want to use Gurobi with python-mip. I run the following:
from mip import Model, GUROBI
Model("test_problem", solver_name=GUROBI)
I receive the following error: InterfacingError('Gurobi ...
0
votes
1
answer
99
views
Create all combinations satisfying a sum condition without expand.grid
I am using R to find the set of values that maximise a certain function (the function is given here by obj_fun). The problem is that for a large number of the parameter pD, I get an integer overflow ...
0
votes
1
answer
156
views
Is pulp.lpDot(a,n) not equivalent to pulp.lpSum([a[i] * n[i] for i in range(N)])?
I have a decision variable vector n, and a is a constant vector. What confuses me is why lpDot(a,n) is not equivalent to lpSum([a[i] * n[i] for i in range(N)]) in a constraint?
Here is the code:
...
0
votes
1
answer
277
views
Solving Knapsack Problem for large dataset using PULP library in Python
I have the below dataframe:
import itertools
import pandas as pd
import numpy as np
p1_values = np.arange(19, 29.1, 0.1)
p2_values = np.arange(23, 33.1, 0.1)
p3_values = np.arange(36, 46.1, 0.1)
...
0
votes
0
answers
33
views
MILP - How to set variable to be absolute value of other variable [duplicate]
In a Milp, given an integer variable x, I would like to define a variable y which will be the absolute value of x.
y = |x|
x is bounded between [M, -M].
Is it even possible?
Thank you!
1
vote
2
answers
1k
views
How to obtain multiple solutions of a binary LP problem using Google's OR-Tools in Python?
I am new to integer optimization. I am trying to solve the following large (although not that large) binary linear optimization problem:
max_{x} x_1+x_2+...+x_n
subject to: A*x <= b ; x_i is binary ...
1
vote
1
answer
435
views
How to write constraint with sum of absolutes in Integer Programming?
I found a solution for just one term here.
How can we formulate constraints of the form
|x1- a1| +|x2-a2| + .... + |xn - an| >= K
in Mixed Integer Linear Programming ?
0
votes
1
answer
140
views
lpSolve constraint for choices of start and length of shifts
I have a finite number of staff N, and I need to find an optimal schedule (using the least number of staff) meeting the demand
Hour of Day
Demand
0
d0
1
d1
...
...
23
d23
where the d0, d1, ..., d23 ...
0
votes
1
answer
75
views
Truck Type (infinite number of them) vs Orders
The goal of the docplex model below is to choose the trucks with total minimum cost to fulfill all orders. I treat the truck type as 1 truck in the following code, but in fact, a truck type can have ...
0
votes
0
answers
282
views
Fastest way to solve non-negative linear diophantine equations
Let A be a list of n lists of m non-negative integers, such that for all j there is i with A[i][j] nonzero. Let V be a list of m positive integers.
Question: What is the fastest way to find all the ...
2
votes
1
answer
862
views
How to convert the following if conditions to Linear integer programming constraints?
These are the conditions:
if(x > 0)
{
y >= a;
z <= b;
}
It is quite easy to convert the conditions into Linear Programming constraints if x were binary variable. But I am not finding ...
0
votes
0
answers
315
views
Building a stacking constraint in Pyomo for Daily Fantasy Sports
I am creating an integer program in Python using pyomo for Major League Baseball (MLB) daily fantasy. Given a lineup of 10 players (1 of each position plus 2 pitchers) and a salary cap, the program ...
0
votes
1
answer
212
views
GAMS Error in MIP Transportation Problem - Uncontrolled set entered as constant
I am trying to formulate an MIP model in which a transportation can be performed by available trains or new ship investments. My current code includes three tables: Monthly costs for trains, monthly ...