Problem Lotka Volterra Model – Modelling & Plotting in Python

I urgently need your help. Currently I’m conducting a research in regards of the revenue calculation and the dynamics within revenue calculation for my masters. I thought of revenue/profit margin as of a dynamical system – Lotka Volterra differential equations. I thought of a contribution margin calculation as within this simple formula:

https://www.accountingformanagement.org/wp-content/uploads/2012/07/contribution-margin-ratio-img4.png

In consequence my idea was the following, but I receive an error:
enter image description here

enter image description here

enter image description here

  • Can anyone help me?
  • Do you think it’s a bad idea to use Lotka Volterra equations for this nonlinear purpose of Sales/Cost/Margin Simulation?
  • How would you model it and why? Am I missing equations or does the simple system already fit the requirements?
  • How do I generate a valid plot out of these results (Phase Portrait etc.)?

Efficient algorithm for this combinatorial problem [closed]

$ \newcommand{\argmin}{\mathop{\mathrm{argmin}}\limits}$

I am working on a combinatorial optimization problem and I need to figure out a way to solve the following equation. It naturally popped up in a method I chose to use in my assignment I was working on.

Given a fixed set $ \Theta$ with each element $ \in (0,1)$ and total $ N$ elements ($ N$ is about 25), I need to find a permutation of elements in $ \Theta$ such that $ $ \vec K = \argmin_{\vec k = Permutation(\Theta)} \sum_{i=1}^N t_i D(\mu_i||k_i) $ $ where $ \vec t, \vec \mu$ are given vectors of length $ N$ and $ D(p||q)$ is the KL Divergence of the bernoulli distributions with parameters $ p$ and $ q$ respectively. Further, all the $ N$ elements of $ \vec t$ sum to 1 and $ \vec \mu$ has all elements in $ [0,1]$ .

It is just impossible to go through all $ N!$ permutations. A greedy type of algorithm which does not give exact $ \vec K$ would also be acceptable to me if there is no other apparent method. Please let me know how to proceed!

Problem with the algorithm

I am trying to execute the following algorithm shown in the image. I am trying to get the table shown in the image:

Backtracking Algorithm

1st Iteration L2: 1:CS=A, SL = A, NSL = A L3: while NSL!=[]: true L4: L6:no children: false L17:NSL =BCDA L18:CS:=B L19:SL=BA L20, L21 2nd Iteration L3:While NSL (true) L4: L6:no children: false L17: NSL=EFBCDA L18: CS:=E L19:SL:= EBA L20, L21 3rd Iteration L3:while NSL (true) L4: L6:no children: false L17:NSL= HIEFBCDA L18: CS:= H L19:SL:=HEBA L20, L21

At this point its fine but when there are no more children of current node, it has to backtrack, so it should execute the while loop, at that point I am losing the track: L3:while NSL(true) L4: L6:no children: true L7:begin L8:while SL is not empty (true) and CS:=H L9: DE=H L10:SL=EBA L11:NSL=IEFBCDA L12:CS=I L14:SL= IEBA

Now it should keep traversing the while loop but I am having problem with this. Somebody please correct this algorithm or guide me a better backtracking algorithm which has the contents of table.

Zulfi.

Near identical MySQL deployments behaving very different – High CPU Usage problem

So I have five identical websites, running on five machines provisioned in the same way. The only thing that differs between these installations are the language files and the languages of the text stored in MySQL tables.

Four of them have no problems what so ever. One is struggling a LOT under the same or somewhat less load than the other four.

I cannot understand why this is.

Things I’ve done so far:

  1. Checked slow queries. All queries uses indexes and are in the realm of 0.0008 Sec execution time i.e. very fast
  2. I’ve noticed that the thing that causes most trouble for this MySQL instance is UPDATE and INSERT, so much so, I’ve turned off the UPDATE’s that were there, for this instance. Bear in mind that these UPDATE’s doesn’t cause a blip on the other servers.
  3. Tried to eliminate external factors i.e. noisy neighbours (moved host) etc.

Worth noticing is that the machines are deployed the same i.e. a vanilla Debian 10 installation with a LEMP stack, nothing out of the ordinary at all.

Still, the problem persists. I can see the load of the machine struggling to keep under 1.00. The other machines are in the 0.10 – 0.20 range all the time.

Looking at CPU for the MySQL process on this machine (with 2 CPU cores as the other machines have as well) it is quite often above 100%. The other machines are never – EVER – over 60% for the MySQL process.

So, any help is much appreciated.

Please do let me know if you need me to run a command that you need to see the output from in order to help.

Thanks.

EDIT Spelling and clarifications

Interpreting the accuracy of solutions to the correspondence problem

I have two pictures of the same object, taken by a car travelling down the road like shown on the right side of the image below. I want to find pixels of the object in each frame that correspond to each other.

Now, in the description of the Middlebury Stereo Evaluation v.3 dataset it says

Maximum disparities range from 200 to 800 pixels at full resolution.

This leads me to my two questions:

  1. Do I understand correctly that algorithms working with the Middlebury dataset had to match pixels that were a distance of 200 to 800 pixels apart, like shown on the left side of the image?
  2. Consider the leaderboard for the Middlebury Stereo Evaluation. Does an average absolute error metric of 1.4 mean, that above problem could be solved for the images in the dataset with an average accuracy of 1.4 pixels?

Correspondence Problem Setup

Subset sum problem with a complication

I have a sorted list of numbers. I know they can be divided into two parts. I also know the sum of those 2 parts. I want to know what these subsets are. How can i find them? The size of my list can be ~ 10^6. The sum of my subsets can be ~ 10^24. Is there a better way to find my subset with a time complexity of O(n*sum) or O(n^2 logn) or is it not possible?

Problem with “does not evaluate to a numeric scalar at the coordinate {2.75,3/2}, but it is outside domain

enter image description here

Problem with "does not evaluate to a numeric scalar at the coordinate {2.75,3/2}, but that point is outside domain. How can I fix it??

Remove["Global`*"] ; Needs["NDSolve`FEM`"] HeatTransferModelAxisymmetric[T_, {r_, z_}, k_, ρ_, Cp_,Velocity_, Source_] := Module[{V, Q}, V = If[Velocity === "NoFlow", 0, Velocity.Inactive[Grad][T, {r, z}]]; Q = If[Source === "NoSource", 0, Source];(1 - (r)^2 - ((1 - 0.5^2)/(Log[1/0.5]))*Log[1/r])*D[T, z] +1/r*D[-k*r*D[T, r], r] + D[-k*D[T, z], z] + V - Q] op = HeatTransferModelAxisymmetric[T[r, z], {r, z}, k, ρ, Cp,"NoFlow", "NoSource"] parameters = {k -> 10, d -> 10}; Subscript[Γ, flux] = NeumannValue[40*(500 - T[r, z]), r == 2.5]; Subscript[Γ, temp] = DirichletCondition[T[r, z] == 1200, r == 1]; Subscript[Γ, enter] = DirichletCondition[T[r, z] == 800, z == 0]; Ω = Rectangle[{1, 0}, {2.5, 3}]; pde = {op == Subscript[Γ, flux],Subscript[Γ, temp],Subscript[Γ, enter]} /. parameters; Tfun =NDSolveValue[pde, T, {r, z} ∈ Ω]; MassTransferModelAxisymmetric[c_, {r_, z_}, d_, Velocity_, Source_] :=Module[{V, Q},V = If[Velocity === "NoFlow", 0, Velocity.Inactive[Grad][c, {r, z}]];Q = If[Source === "NoSource", 0, Source];(1 - (r)^2 - ((1 - 0.5^2)/(Log[1/0.5]))*Log[1/r])*D[c, z] + 1/r*D[-d*r*D[c, r], r] + D[-d*D[c, z], z] + 4.67`*^14*Exp[-36635/(Tfun[r, z])]*c + V - Q] op2 = MassTransferModelAxisymmetric[c[r, z], {r, z}, d, "NoFlow","NoSource"] Subscript[Γ, enter] = DirichletCondition[c[r, z] == 800, z == 0]; pde2 = {op2 == Subscript[Γ, enter]} /.parameters;cfun=NDSolveValue[pde2, c, {r, z} ∈ Ω]; 

Finding a valid equation for fixed point problem

I currently am working on learning more about fixed point method. Finding equations that satisfy the constraints of a g function can sometimes require a bit of engineering. I have come across one that many would consider simple. Yet, I have been stuck on it for some time now.

Here it is $ f(x) = x^2 – x – 2 = 0 $ on $ [1.5,3]$ .

I have tried many things; however, I have yet to successfully discover one that maps domain to range for both $ g$ and $ g^\prime$ .

Would anyone be able to give me a guiding hand?

Problem with return 2 libc in 64 bit arch

Good day guys I want to perform return to libc in 64 bit architecture using execve. I found a gadget with /bin/sh in it (the /bin/sh offset is 18a143):

   cbcd8:       00 00     cbcda:       4c 89 ea                mov    rdx,r13    cbcdd:       4c 89 e6                mov    rsi,r12    cbce0:       48 8d 3d 5c e4 0b 00    lea    rdi,[rip+0xbe45c]        # 18a143 <_libc_intl_domainname@@GLIBC_2.2.5+0x17e>    cbce7:       e8 94 f9 ff ff          call   cb680 <execve@@GLIBC_2.2.5> --    cbd92:       48 85 c0                test   rax,rax 

now I fill the return address (RIP) with (address of libc + 0xcbce0) with this payload:

r $  (python -c 'print "A"*120 + {libc+-xcbce0}') 

. Here are the registers:

RAX: 0xffffffffffffffff  RBX: 0x0  RCX: 0xffffffffffffff80  RDX: 0x0  RSI: 0x555555555060 (<_start>:  xor    ebp,ebp) RDI: 0x7ffff7f79143 --> 0x68732f6e69622f ('/bin/sh') RBP: 0x4141414141414141 ('AAAAAAAA') RSP: 0x0  RIP: 0x7ffff7ebacef (<maybe_script_execute+175>:        mov    rax,QWORD PTR [rbp-0x28]) R8 : 0xffffffff  R9 : 0x8a  R10: 0x7fffffffdfb0 ('A' <repeats 120 times>, "443777") R11: 0x202  R12: 0x555555555060 (<_start>:  xor    ebp,ebp) R13: 0x0  R14: 0x0  R15: 0x0 

and here are tho codes around execve:

 0x7ffff7ebace0 <maybe_script_execute+160>:   lea    rdi,[rip+0xbe45c]        # 0x7ffff7f79143    0x7ffff7ebace7 <maybe_script_execute+167>:   call   0x7ffff7eba680 <execve>    0x7ffff7ebacec <maybe_script_execute+172>:   mov    rsp,rbx  0x7ffff7ebacef <maybe_script_execute+175>:   mov    rax,QWORD PTR [rbp-0x28]    0x7ffff7ebacf3 <maybe_script_execute+179>:   sub    rax,QWORD PTR fs:0x28    0x7ffff7ebacfc <maybe_script_execute+188>:   jne    0x7ffff7ebad4b <maybe_script_execute+267>    0x7ffff7ebacfe <maybe_script_execute+190>:   lea    rsp,[rbp-0x18]    0x7ffff7ebad02 <maybe_script_execute+194>:   pop    rbx 

but it not works and gives Bus Error.Thanks for help.