10,937 questions
1
vote
4
answers
52
views
Implementing iteration in Standard SQL (BigQuery)
I have an audit table (with tablename, date and rec counts) with data as far back as 5 yrs as shown below. My requirement is to retrieve the record counts for the tablename for a specific day and it's ...
-1
votes
1
answer
39
views
for planets in Planet: TypeError: 'type' object is not iterable [closed]
I'm working through an example and cannot see the solution.
Can someone please point me in right direction?
Tried lots of stuff.
File "C:\Python prog\orbit.py", line 57, in main
for ...
-1
votes
0
answers
84
views
Is this DP function correct for the given prompt?
S(n) = 1 if n = 1
2 if n = 2
S(n - 1) + S(n - 2) if n is even
2S(n - 1) - S(n - 2) if n is odd and n > 2
SOLUTION:
def layup_s(n):
# given base cases
if n == 1:
...
-3
votes
0
answers
106
views
I want to generate a permutation to check it satisfies an equation before I generate another
I'm writing code to find a convex n-gon with side lengths 1^k,2^k,...,n^k with equal interior angles. If we formulate this as an algebra problem on the complex plane, this is satisfied using the ...
2
votes
1
answer
108
views
get the index of a C++ foreach item in a debugger
Lets assume the code doesn't need the index, but something interesting happened during debugging and I want to know the position of the item in the container.
for (int item : myarray)
doSomething(...
-3
votes
1
answer
37
views
How can I write the values of a decision variable to an Excel sheet after running an iterative optimization in CPLEX OPL?
I am performing an iterative optimization using the main function in CPLEX OPL. After each iteration, I want to write the values of the decision variables to an Excel sheet. The optimization runs for ...
2
votes
0
answers
91
views
Array copies one too many values if there is an empty line in the input file?
Working on an assignment for my coding class which involves the function below, which is supposed to read quiz scores from an input file and put up to 12 of them into an array. I've narrowed down the ...
0
votes
2
answers
124
views
For a custom Mapping class that returns self as iterator, list() returns empty. How do I fix it?
The following is a simplified version of what I am trying to do (the actual implementation has a number of nuances):
from __future__ import annotations
from collections.abc import MutableMapping
...
0
votes
0
answers
35
views
Jacobi method converges faster than Gauss-Seidel in case of Laplace equation
It is need to solve the problem using the Jacobi method: d^T/dx^2 + d^2T/dy^2 = 0 with conditions at the boundaries of the square:
T(0, y) = 1, T(x, 1) = 1, dT/dx(1, y) = 1 - y, dT/dy(x, 0) = x.
...
0
votes
1
answer
39
views
How can I update a matrix in the current iteration while preserving the values from previous iterations using the main function in CPLEX OPL?
I want to update a matrix with values of the current iteration as well as the previous iteration in the main function. Please help me in achieving this. I have tried this code.
int TSlots = 96;
...
2
votes
1
answer
36
views
How to update a matrix in iterative optimization using cplex opl?
I am solving an iterative optimization problem in cplex opl using the main function. However, I am getting errors while printing a matrix value. Please help me in solving this issue.
int Nod=41;
...
-4
votes
2
answers
124
views
Iterating over JSON containing lists of dictionaries in python [closed]
Please help in providing a solution to iterate through a JSON response containing lists of dictionaries in python:
{
"cart": [
{
"id": "0Zy2jwLzQzlk7xq3",
...
3
votes
4
answers
182
views
Fastest way to find indices of highest value in a matrix iteratively and exclusionarily
I'm attempting to find the "best hits" in a similarity matrix (i.e. an mxn matrix where index along each axis corresponds to the ith position in vector m and the jth position in vector n). ...
1
vote
1
answer
23
views
How to include .dat file while writing a code in cplex opl using main function?
I am trying to solve an iterative optimization problem in cplex opl using main function. The optimization objective and constraints are written in subvaluenew.mod.
float maxOfx = ...;
dvar float x;
...
0
votes
1
answer
35
views
How to update non-decision variables/parameters Iteratively in CPLEX OPL using main function?
I am running a CPLEX OPL model for 10 entities. The objective is to optimize a certain objective for each entity.
Step 1: The CPLEX model first runs for the first entity, optimizing the objective ...