mathematical-optimization

Is there a way to adjust this system of non linear equation

南楼画角 提交于 2019-12-13 17:38:03
问题 I've been to solve this problem for the last 2 days with no success. say we have this system : the has an infinite number of solutions when : to get value of the angle Theta, I use this formula : The value that I get is correct but only in some points, because the system isn't solvable. and here is how it looks like : the red curve represents the "must be" value and the blue one represents that I actually get. after ploting the value of the sum : here is what I get : as you can see it's sinus

Get coefficients of a linear pyomo constraint

寵の児 提交于 2019-12-13 17:26:33
问题 I would like to obtain the coefficients of a linear constraint c of a pyomo model m . For instance, for m= ConcreteModel() m.x_1 = Var() m.x_2 = Var() m.x_3 = Var(within = Integers) m.x_4 = Var(within = Integers) m.c= Constraint(expr=2*m.x_1 + 5*m.x_2 + m.x_4 <= 2) I would like to get the array c_coef = [2,5,0,1] . The answer to this question explains how to obtain all variables occurring in a linear constraint and I can easily use this to create the zero-coefficients for variables which don

Java Optimizing arithmetic and Assignment Operators for large input

末鹿安然 提交于 2019-12-13 12:32:41
问题 I have a piece of code that must run extremely fast in terms of clock speed. The algorithm is already in O(N). It takes 2seconds, it needs to take 1s. For most A.length inputs ~ 100,000 it takes .3s unless a particular line of code is invoked an extreme number of times. (For an esoteric programming challenge) It uses a calculation of the arithmetic series that 1,2,..N -> 1,3,4,10,15.. that can be represented by n*(n+1)/2 I loop through this equation hundreds of thousands of times. I do not

Conditional mathematical optimization in R

你离开我真会死。 提交于 2019-12-13 06:08:47
问题 I have the following data frames: Required <- data.table( Country=c("AT Iron", "AT Energy", "BE Iron", "BE Energy", "BG Iron", "BG Energy"),Prod1=c(5,10,0,5,0,5),Prod2=c(25,5,10,0,0,5)) Supplied <- data.table( Country=c("AT Iron", "AT Energy", "BE Iron", "BE Energy", "BG Iron", "BG Energy"),Prod1=c(10,5,5,10,5,10),Prod2=c(20,20,20,0,15,10)) > Required Country Prod1 Prod2 1: AT Iron 5 25 2: AT Energy 10 5 3: BE Iron 0 10 4: BE Energy 5 0 5: BG Iron 0 0 6: BG Energy 5 5 > Supplied Country Prod1

Javascript Packing with many constraints, looking for a simple solution

亡梦爱人 提交于 2019-12-13 05:36:27
问题 This is not exactly packing as I can assign rectangle sizes myself, I just need a packed result. I have rectangles of same ratio and different sizes FULL, HALF(area = 1/4 * FULL), QUARTER(area = 1/4 * HALF). All will be positioned horizontally only. The container is of width 3 times FULL and height will adjust to fit rectangles. There will be 150 rectangles which will be given random sizes from array(full,half,quarter). Now I want to arrange these rectangles in the container so that there is

R. Run optimization function in data frame

余生颓废 提交于 2019-12-13 05:10:32
问题 I have a data frame df1 in R that looks like this (all values were chosen randomly but approximate values from real data): A B C D E F G H a 0.04 0.01 50 70 0.01 ... 0.0002 b 0.03 0.1 49 69 0.01 ... 0.0003 c 0.03 0.02 51 71 0.005 ... 0.004 d 0.04 0.02 50 70 0.006 ... 0.0005 G is obtained in this way: # Equation 1: G = (B - C)^2 - B*(1 - B)/(D- 1) - C*(1 - C)/(E - 1) library(dplyr) df2 = df1 %>% mutate(G = (B - C)^2 - B*(1 - B)/(D- 1) - C*(1 - C)/(E - 1)) I want to create a new column G1

how to force succesive variable to be of same value?

北战南征 提交于 2019-12-13 04:35:52
问题 I have a binary variable y[k][t] , where k = 1..3 (machines) and t = 1..10 (time). Variable Y is 1 if machine is active and 0 otherwise. In the optimization if machine 1 is active in period 1 e.g. Y[1][1] = 1 , i want the machine to continue to operate for at least 3 time periods. i.e. Y[1][1] = Y[1][2] = Y[1][3] = Y[1][4] = 1 . I only want the succesive variable for t+1,t+2,t+3 to be same as t if it is active. how can i do that in cplex studio? 回答1: what Erwin wrote about minimum run length

Limits of CPLEX

北城以北 提交于 2019-12-13 03:59:26
问题 We have a problem involving 100K variables in the objective function and 1500 conditions. Does CPLEX support such numbers? If so, what are the limits and performance benchmarks of CPLEX? Regards, Yash 回答1: YES . Quoting a reply from CPLEX developers in this thread, dated in 2010: CPLEX can handle 30 million variables. The more interesting question will be: does your machine have enough memory for that. CPLEX needs to store lower, upper bounds and objective function coefficients as double

optimize has weird behavior when I change the interval

久未见 提交于 2019-12-13 02:51:57
问题 I have a problem with optimize() in R. When I only change the interval in optimize() , surprisingly, the optimal parameter value will vary a lot. I found posts with similar problems before, but there is no answer for them. I got really different values from different intervals: c(-1,1): -0.819 c(-1,2): -0.729 c(0.3,0.99):0.818 c(0.2,0.99):0.803 c(0.1,0.99):0.23 c(0,0.99):0.243 I really need help on this problem, thank you guys if you could help or give me any information!! edit : here is a

How to check whether the model coded in CPLEX in .NET is the true model?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 01:26:25
问题 I coded an MIP in CPLEX with C#. I declared variables and constraints and added the objective but I cannot get the correct answer. Is there a way to print the model into a string variable or something like in order to check whether I coded correctly the model I had in mind? 回答1: You could try exporting it in CPLEX LP format, that is human readable. I use neither CPLEX nor .NET, but according this website the function you are looking for is: LOG CPLEX .NET Reference Manual Cplex.ExportModel