Questions tagged [linear-optimization]
38 questions
3
votes
1 answer
Microsoft Solver Foundation gives wrong answer for a simple ILP
I want to solve a binary Linear Problem in C# using Microsoft Solver Foundation. I don't know why I get wrong answer. The Objective Value should be 41.1 but I get 213. The value of 5 variables should be 1 and the other ones should be 0. But I get…

shm
- 439
- 2
- 11
- 25
2
votes
1 answer
Linear Optimization / Max Calories in R (lpSolve)
given a price and calorie matrix, I am trying to solve for the maximum amount of calories possible to buy with $15. I've read the docs for lpSolve + some older answers on here, but I am still having trouble setting up my equation. I also want to…

codeweird
- 145
- 3
- 11
2
votes
0 answers
Linear Optimization in Math.net
Math.NET seems to have a significant amount of functions dedicated to non-linear optimization, which would seem to imply that it also has some faculty for performing linear optimization, but I've been looking through the documentation and can't seem…

The Zach Man
- 738
- 5
- 15
1
vote
1 answer
How to linearize the product of a 2-values-categorical variable and a non-negative continuous variable?
I have been looking for the answer to this question for quite a long time, but couldn't find one. I know the solution in case the multiplication is between a binary (0-1) and a continuous variable, but not in case the multiplication is between a…

Andrea Neri
- 75
- 6
1
vote
1 answer
AMPL program giving zero optimal value
My objective functions optimal value is confirmed to be non-zero, but I am getting 0 for it while trying to run an ampl program. Can you please help?
The mod file contains my constraints and objective function. I am solving this using the simplex…

Sahil Sahu
- 63
- 6
1
vote
2 answers
PuLP - error when constraining variables that are mutually exclusive
I'm using PuLP to try to solve an optimization problem, but keep getting "Status: Infeasible" when I try to set a constraint on the sum of the decision variables while they are also constrained by mutual exclusivity.
See my code below. I'm using…

wizardjoe
- 185
- 9
1
vote
0 answers
MILP Pyomo Piecewise linear expression of battery performance
I try to implement a piecewise linear expression for the battery performance within an energy optimization problem using pyomo. I am using the pyomo.Piecewise libary.
My fictive performance function of the battery charge process has following…

fabmid
- 11
- 2
1
vote
1 answer
How to get a random choice under some constraints using JuMP in Julia
I know JuMP can solve a linear optimization problem under some constraints and maximize an objective function. Is it also possible to get a random choice under some constraints using JuMP? The pseudo-code can be given as:
…

PokeLu
- 767
- 8
- 17
1
vote
1 answer
Dual and reduced costs using SimplexSolver from ojAlgo
I would like to solve a linear problem using the simplex from ojAlgo (version 51.4.0) and to be able to retrieve its dual variables as well as its reduced costs. I was expecting the method getMultipliers() from Result to return the dual variables…

Taxation
- 13
- 2
1
vote
1 answer
Figure out the weights of a weighted average in Google Sheets or Excel
Scores in this datset in sheets are calculated using a weighted average of 4 variables in columns B:E. The weighted average is the same for each line.
Given several lines of scores and variables, how can the weights be discovered in excel or…

MMsmithH
- 323
- 1
- 8
1
vote
2 answers
How to speed up linear programming problem solution?
I have the following problem. I have n (typically n = 1000) data points (integers from {1,2,3}, so there are a lot of repeting numbers) and a real number d. I have to choose k

treskov
- 328
- 1
- 4
- 17
1
vote
0 answers
Fastest LP free Library in python, with copy Function
i have written a linear optimization problem in PuLP and it works great.. but the solving time is huge, so i have tried another optimization library google-OR that is x10 time fister but has a big issue that doesn't allow to deepcopy the problem…

Lorenzo ITO
- 11
- 1
1
vote
1 answer
Linear optimization with pyomo
I recently started to try and learn python in order to solve a linear optimization problem.
I am trying to minimize the CO2-Emission for househould. The solver is supposed to choose between getting electricity from the grid (which includes a certain…

saschav
- 37
- 6
1
vote
2 answers
Julia JuMP Constraint from Vector
I'm practicing with Julia but got stuck trying to make a constraint.
# Server Costs
> df_custos = DataFrame(C1=[2,4,3],C2=[1,2,1],C3=[3,3,2],C4=[6,2,3],)
# City num
> num_cidades=ncol(df_custos)
# Server num
> num_servidores =…

Yuri
- 73
- 6
1
vote
1 answer
Obtaining a good suboptimal solution from ojalgo for a linear optimisation
Introduction
I'm trying to use the ojalgo library to produce a solution to controlling thrusters placed in arbitrary places to generate an overall requested rotation and translation. Sometimes the requested rotation and translation will not be…

Richard Tingle
- 16,906
- 5
- 52
- 77