#### Category : optimization

I’m Trying To Solve A Problem. Given 2 arrays of integers, A and B, both of size n. Suppose you have a list of integers, initially empty. Now, you traverse the 2 arrays simultaneously for every i from 1 to n, and perform the following operation: You append Ai to the list. If the list ..

Read more

Suppose I have defined a datatype, as below: class mytype(object): def __init__(self, x=1, y=2, z=3): self.x = x self.y = y self.z = z And I have an numpy array of type mytype, which is defined as: my_array = np.array([mytype()]*1000) And my question is: how to extract the values of the numpy array defined above ..

Read more

My very first post and question here… So, let list_a be the list of lists: list_a = [[2,7,8], [3,4,2], [5,10], , [2,3,5]…] Let list_b be another list of integers: list_b = [5,7] I need to exclude all lists in list_a, whose items include at least one item from list_b. The result from example above schould ..

Read more

I am trying to optimize self.parameters() with torch.optim.adam.Here is the original code: def learning_rate_adjust(self, args): self.learning_rate *= 0.8 self.train_op = torch.optim.Adam(self.parameters(), lr=self.learning_rate, weight_decay=args.l2_reg) but when I run this code,here is the bug: Traceback (most recent call last): File "main.py", line 37, in <module> train(args, loader, train_set_length, test_seq, item_attr_set, [], []) File "E:ACAM24ACAM-model-masterACAM-modelcodetrain.py", line 62, in ..

Read more

I have a 49×49 dataframe that looks like this normal fire water electric …. max normal 0 0 0 0 500 fire 0 0 0 0 400 water 0 4 0 0 450 electric 0 0 2 0 500 . . I want to find the combination of 6 rows that meet certain criteria. For ..

Read more

I want to reduce the time coplexity of this code therefore I need to convert Solve function from recursion to iteration. Please help me. n, m = map(int, input().split()) p =  * m target = 2 ** m – 1 def solve(i, subset, size): if subset == target: return size if i == n: ..

Read more

I’m currently working with two student colleagues with the optimization package pymoo. We have searched in the documentation but we are still strugling to solve some issues. The main challenge is to define and implement our problem. This problem consist on an optimization of a protein based classifier. Our aim is to minimize the number ..

Read more

I want to find the parameters of a Weibull distribution by minimizing the parameters using Kullbak-Leibler method. I found a code here which did the same thing. I replaced the Normal distributions in the original code by the Weibull distributions. I do not know why I get “Nan” parameters and “Nan” Kullback-Leibler divergence value. Can ..

Read more

I am trying to solve an optimization problem using the optimization module of scipy (differential evolution algorithm). In the simplest case, I want to fit two functions to experimental values. In the range of lower x-values function 1 is used, in the range of higher x-values function 2. The switching between the two functions is ..

Read more

I ran into a problem while creating a virtual screen in kivy. I want the application to create an additional screen that can be scaled. I tested kivy.graphics.rectangle, but drawing 10,000 of these rectangles takes almost half a second (the size of the additional screen is approximately 75% of the area and its average resolution ..

Read more