Questions tagged [optimal]
35 questions
0
votes
0 answers
cplex and iteratating on two lists
I am trying to start with IBM ILOG CPLEX but I'm having difficulties with iterations... I have two different lists. The first one has 6 entries (A, B, C, ...) each having arguments (a1, a2, a3, a4, a5, a6), and the second list has about a hundred…

v777
- 1
- 1
0
votes
0 answers
Hash Function on Intersecting Sets
Say we have a family of (not necessarily disjoint) sets S={S_{1}, S_{2}, S_{3}..S_{n}}. Say each set has size O(k). I need a hash-function h : S -> P (P could be anything) such that h(S_{i}) = h(S_{j}) IFF S_{i} and S_{j} intersect.
I want this hash…

user472374
- 1
- 1
0
votes
0 answers
Calculating optimal variation of maximum number of products
I'm creating a program which calculates products that can be made from available ingredients based on different recipes. User can add new recipes, ingredients and their quantities. Recipes may contains same ingredients.
I have a List from recipes…

Fallon
- 11
- 2
0
votes
0 answers
Mutation Error and Crossover Error not working properly
library(GA)
# Define the problem
set.seed(123)
assets <- c("Asset 1", "Asset 2", "Asset 3", "Asset 4", "Asset 5", "Asset 6", "Asset 7", "Asset 8", "Asset 9", "Asset 10")
criteria <- c(0.5, 0.3, 0.2) # We want to select assets that meet this…
0
votes
2 answers
If-Else with few lines vs. Ternary Operator with more lines in Flutter
I have a Flutter program in which the click of a button changes something depending on the state of the button. I implemented it using ternary operator (which calls functions) and also with just an if-else block.
Using ternary:
void functionA() {
…

xander309
- 3
- 1
0
votes
0 answers
python function as cvxpy parameter for dynamic optimization (optimal control)
import numpy as np
def af(a,b):
return np.array([[a,b],[b**2, b]])
np.random.seed(1)
n = 2
m = 2
T = 50
alpha = 0.2
beta = 3
# A = np.eye(n) - alpha * np.random.rand(n, n)
B = np.random.randn(n, m)
x_0 = beta * np.random.randn(n)
import cvxpy as…

Starpower Power
- 31
- 1
0
votes
0 answers
Solving Minimum time target problem by solving HJB equation numerically
Here is the problem where I am trying to solve by solving HJB equation, where the following term is coming:
To solve this, what I am doing is from one point I am iterating for all u than deciding h that stencil remains in the 9 point neighborhood,…

Sounak Mojumder
- 23
- 4
0
votes
0 answers
How to resolve ladder constraints with pulp
We now have a scenario where the cost of sending SMS channels is optimal. There are hundreds of channels, which support different types of SMS messages, different suppliers, and multiple operators. In addition, each channel has different prices and…

user21040411
- 1
- 1
0
votes
1 answer
Pyomo: Getting keyerror: 4903576400
I'm trying to solve an optimal control problem using pyomo, but I always get this keyerror which seems like a series of random numbers.
KeyError Traceback (most recent call last)
in…
0
votes
1 answer
wasserstein_1D returns an error for a correct expression
I am trying to calculate the p-Wasserstein distance using (POT : Python Optimal Transport) module.
The following code returns an error, whereas the expression seems correct to me (after https://pythonot.github.io/all.html).
Any ideas why?
import …

Artashes
- 102
- 1
- 9
0
votes
1 answer
JavaScript how to create method working similar with many properties without code repeating?
I want to create an object with properties and some properties need to be treated with two similar methods, how to make it optimal without reapeting the code? Here is the example of the object it seems it suppose to be the way to make it much easier…

Vic Novosad
- 1
- 3
0
votes
1 answer
Python Multithreading: Check active domains with multithreading in python optimally
The idea of the program is to check for domains/subdomains living (via http/https protocol) in the subdomains.txt file.
I did this by using HEAD requests to domains/subdomains and receiving the response status code. If the status code is available,…

Quang Tran
- 3
- 2
0
votes
0 answers
Get maximum elements of two arrays there sum <= S
I have two arrays: A with size sz_a and B with size sz_b. I need find first m elements from A and first n elements from B. For all elements A[i]>0,B[i]>0.I need find m+n->max, sum(A[1..m] + sum(B[1..n])<=S.
1.Example 1
A=[1,4,1,1]
B=[1,2,3,3]
S =…

john
- 1
0
votes
0 answers
Consistent Heuristic Search - Tiebreaking Policy
So I have the following question in my midterm review and I'm not really sure how to go about it, it's the only one I couldn't figure out. The notation we used in class is that f(n) = g(n) + h(n)
g(n): Cost from start to current
h(n): Estimated…

A. Boy
- 47
- 1
- 5
0
votes
2 answers
Optimal substructure for combining a disjoint subset
I'm looking to understand how this problem shows optimal substructure:
Problem:
Given any binary tree with only positive integers as nodes, how can you find a disjoint subset (made from nodes that have no edges between them) to achieve the biggest…

coco
- 1
- 1