solver

How to solve a system of equations and constraints for portfolio optimization?

痴心易碎 提交于 2021-02-19 08:00:07
问题 I have a DataFrame as follows : Name Volatility Return a 0.0243 0.212 b 0.0321 0.431 c 0.0323 0.443 d 0.0391 0.2123 e 0.0433 0.3123 I'd like to have a Volatility of 0.035 and the maximized Return for that volatility. That is, I'd like, in a new Df the Name and the percentage of that asset that will be in my portfolio that gives the maximum Return for a Volatility equals to 0.035 . Therefore, I need to solve a system of equations with multiple conditions, to obtain the best solution (Highest

solve_ivp differential equation solver, way to not integrate all return values?

断了今生、忘了曾经 提交于 2021-02-11 12:31:59
问题 Hey i have a model which gives diferential return values. But also a value which isnt a differential (z) def model(t, f): x = f[0] y = f[1] dx_dt = 2x*y dy_dt = x**3 z = 2*x return dx_dt, dy_dt, z My solver can solve this equations and give me x and y at the respective time values. t = np.linspace(0, 10, 100) f0 = [2, 1, 0] result = solve_ivp(model, [np.min(t), np.max(t)], f0, t_eval=t) But now i want also my solution for z which should NOT be integrated by the solver. Is there any

Z3 Solver Java API: Unexpected behaviour

删除回忆录丶 提交于 2021-02-09 07:54:34
问题 By adding conditions to the solver, I want to check with "solver.check()", whether there exists a solution or not. Therefore, I created a simple example to find a solution for t1. I know that there is a solution for t1, namely t1 = 0. Nevertheless, the solver has not the status "SATISFIABLE". public static void main(String[] args) { int h_max = 7; HashMap<String, String> cfg = new HashMap<String, String>(); cfg.put("model", "true"); Context ctx = new Context(cfg); FPSort s = ctx.mkFPSort(5,

Z3 Conditional Statement

放肆的年华 提交于 2021-02-08 10:45:25
问题 How to write a conditional statement in Z3. eg: if (a%2==0){ value=1 } I am trying to achieve this in Z3 Solver by Microsoft Research but so far no luck 回答1: Look up SSA form: https://en.wikipedia.org/wiki/Static_single_assignment_form Essentially, you'll have to change your program to look something like: value_0 = 0 value_1 = (a%2 == 0) ? 1 : value_0 Once it is in this so called static single assignment form, you can now translate each line more or less directly; with the latest assignment

Create Reduced Ordered Binary Decision Diagram (ROBDD) from truth table

旧巷老猫 提交于 2021-02-07 07:57:17
问题 Is there a software package (preferable an application, not library) that creates Reduced Ordered Binary Decision Diagrams (ROBDDs) from a given truth table (in some text format)? 回答1: You can also try this: http://formal.cs.utah.edu:8080/pbl/BDD.php It is the best tool for BDDs I used so far. 回答2: With any BDD library you can do what you want. Of course, you must write a piece of code by yourself. If you are looking for a lightweight tool, I often use an applet like this to have a quick look

Create Reduced Ordered Binary Decision Diagram (ROBDD) from truth table

淺唱寂寞╮ 提交于 2021-02-07 07:55:09
问题 Is there a software package (preferable an application, not library) that creates Reduced Ordered Binary Decision Diagrams (ROBDDs) from a given truth table (in some text format)? 回答1: You can also try this: http://formal.cs.utah.edu:8080/pbl/BDD.php It is the best tool for BDDs I used so far. 回答2: With any BDD library you can do what you want. Of course, you must write a piece of code by yourself. If you are looking for a lightweight tool, I often use an applet like this to have a quick look

How to rewrite Maple code to Matlab, functions fsolve() and solve()?

你离开我真会死。 提交于 2021-02-05 12:21:11
问题 I have an ordinary differential equation (ODE) -- Van Der Pol oscillator Problem: y''-2a (1-y^2)y'+y=0, y(0)=0, y'(0)=0.5, x in [0,10], a =0.025. The ODE was solved on Maple Software with the fsolve() function. I need to rewrite the code on Matlab (version R2013a). My attempt is below. n = 0 h = 0.1 syms z0; % z in point 0 syms y0; % z in point 0 f0 = 2 * 0.025 * z0 - 2 * 0.025 * ((y0)^2) * z0 - y0 syms z1; % z in point 1 syms y1; % z in point 1 f1 = 2 * 0.025 * z1 - 2 * 0.025 * ((y1)^2) * z1

Tower Of Hanoi - Solving Halfway Algorithm in Python

拈花ヽ惹草 提交于 2021-02-04 20:02:00
问题 Is it possible to solve tower of hanoi halfway? I've done extensive research to look for codes that solves the user's configuration halfway but I've yet to find one. This is for an assignment and I require the code to take over from where the user has stopped solving and continue solving it for the user, without resetting the puzzle to square one. I understand that there are recursion algorithms out there readily available but that is not what I'm searching for. I'm searching for algorithms

Select 6 items while maximizing values under constraints [closed]

旧巷老猫 提交于 2021-01-29 08:59:52
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 8 months ago . Improve this question I have numerous data points of items of which have a predetermined price-tag associated with them as well as a self calculated return value of each item. I'm looking to select 6 of the 100+ items in order to maximize the total return value while keeping the

Preferred means for finding common tangent to a pair of ellipses in C++ [closed]

て烟熏妆下的殇ゞ 提交于 2021-01-27 17:04:31
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . Improve this question I want to do this in C++. I have got two ideas by which I can do this: Considering the pair of ellipses as parametric equations of two different parameters, I can get two equations in terms of the two parameters. This pair of equations is non-linear, both