Category "optimization"

Reasonable neighbours for a bees algorithm on a not-complete digraph

I am trying to solve an optimization problem for a graph, where basically there is a cost for transporting "package" over a single edge, and I have multiple sou

Convert a set of overlapping cuiboids to a minumum set of non-overlapping cuiboids

I am trying to decompose an overlapping set of cuboids to non-overlapping ones, the fewer non-overlapping cuboids used the better. For example, in the case belo

List in Python help needed: how to Avoid calling repetitive code

I have a function shown below: def _extract_parent(matched_list, json_data, info_type): return [json_data[match_lst][info_type] for match_lst in matched_lis

How to find minimum number of NAND gates for a given Boolean Expression by Using Genetic Alogorith(How to write a Code )

I have been trying to write a code using gentic algorithm to find minimum number of NAND gates,but i have no idea of how to take a chromosome or case to find na

Longest increasing subsequence with minimum sum

I know there is a longest increasing subsequence algorithm that runs in O(nlogn) (https://www.geeksforgeeks.org/longest-monotonically-increasing-subsequence-siz

Emulating Polymorphism without virtual pointers/overhead

Before reading I must emphasise I have demanding performance requirements (not premature optimization- processing millions of messages and need to design with p

do two instances from the same Spark Streaming can be in conflict?

I want to run the same Java Spark Streaming (10 seconds micro batch) through 2 instances (sparkStr1 and sparkStr2). Mainly, they consume the same kafka topic (3

Most insanely fastest way to convert 9 char digits into an int or unsigned int

#include <stdio.h> #include <iostream> #include <string> #include <chrono> #include <memory> #include <cstdlib> #include <

Is there a way to get rid of these loops in or-tools, and what other libraries that do optimization in python

This code block is from OR-Tools docs, and I want to remove these for-loops. Is there a way to vectorize the code? The issue here is that I expect to have the n

Linearize optimization of non-overlapping items along a sequence

This is a follow-up to my previous question here. I have a optimization model that tries to find the highest coverage of a set of probe to a sequence. I approac

How can I reduce the number of database queries for a one to many association in Strawberry GraphQL and FastAPI?

I'm developing a python GraphQL API server using FastAPI and Strawberry, and I'm implementing this feature: I have two entities, User and Order, which have a on

How to structure data without bloating the size because of alignment?

Lets say we have a struct Original as this: class Original { int x; bool y; bool z; }; Due to alignment, the sizeof(Original) is 8 bytes. 4 for the int,

Why is the XOR swap optimized into a normal swap using the MOV instruction?

While testing things around Compiler Explorer, I tried out the following overflow-free function for calculating the average of 2 unsigned 32-bit integers: uint3

Count nodes within k distance of marked nodes in grid

I am attempting to solve a coding challenge however my solution is not very performant, I'm looking for advice or suggestions on how I can improve my algorithm.

ValueError: Covariance matrix does not match expected returns

I am trying to optimize a portfolio for a certain timer period Error message

how to write ant colony optimization code

i have a function function t=strength(x) t(1) = -0.804-0.001.*x(1)-0.001.*x(2)+0.0.*x(3)+0.0.*x(4)-0.031.*x(5)+0.005.*x(6)-0.002.*x(7)+0.001.*x(8)-0.735.

Time and Space complexity of the max disk space

from collections import deque def findMax(hardDiskSpace, k): n = len(hardDiskSpace) if n * k == 0: return [] if k > n: return []

Shorten JSON reading class

I have a simple JSON reading class that should grab values from a JSON object and put it in c# variables. Right now it uses 8 if statements, but I was wondering

how to model a GEKKO constraint to guarantee the count of variables with same value > k

I have the following objective function : Minimize(sum(abs(di[i]-d[i]) ) ) and I want to add a constraint to make sure that d[i] is appeared at least k times i

TensorFlow optimisation during running model speed up Predict

I want to disable a computation of several filters during Predict call with Tensorflow 2 and Keras. Do i have to modify the source code of Tensorflow to achieve