optimization

Multi-class Logistic Regression from scratch

我只是一个虾纸丫 提交于 2021-02-10 14:15:48
问题 I am trying to implement from scratch the multiclass logistic regression but my implementation returns bad results. I believe the definition of the gradient function and the cost function is fine. Maybe there is a problem with how these functions are interacting with the minimize function. I have tried it but I could not find out what is wrong. Could you please cast some light? You can add the estimator 'myLR': myLR(**par_dict), with paramters par_dict= {'alpha': 0.1, 'maxit': 2000, 'opt

Optimal trajectory to minimize force, issues with final conditions

谁说我不能喝 提交于 2021-02-10 09:47:58
问题 I am trying to find a trajectory that minimizes the squared integral of the force to move a block from one point to another. Here are the system dynamics: dx/dt = v (derivative of position is velocity) dv/dt = u (derivative of velocity is acceleration, which is what I am trying to minimize) min integral of u**2 The initial conditions and final conditions are: x(0) = 0, v(0) = 0 x(1) = 1, v(1) = 1 I have implemented this in python using the Gekko library, but I cannot get the final conditions

How to calculate the shadow price in Gurobi

那年仲夏 提交于 2021-02-10 07:14:11
问题 I want to analyze whether the boundary should increase or reduce in Constraints in a programming problem: The following is simplified problem. V[(i,t)] is decision variable and S[i] is input. I want to know if the obj increases or reduces when increasing one unit of S[i]`. I know may the shadow price and marginal cost are for decision variable not inputs. In Gurobi, Dual value (also known as the shadow price) can use the Pi function. for t in range(T): for i in range(I): m.addConstr(V[(i,t)]

How to calculate the shadow price in Gurobi

为君一笑 提交于 2021-02-10 07:09:36
问题 I want to analyze whether the boundary should increase or reduce in Constraints in a programming problem: The following is simplified problem. V[(i,t)] is decision variable and S[i] is input. I want to know if the obj increases or reduces when increasing one unit of S[i]`. I know may the shadow price and marginal cost are for decision variable not inputs. In Gurobi, Dual value (also known as the shadow price) can use the Pi function. for t in range(T): for i in range(I): m.addConstr(V[(i,t)]

How to calculate the shadow price in Gurobi

拟墨画扇 提交于 2021-02-10 07:07:58
问题 I want to analyze whether the boundary should increase or reduce in Constraints in a programming problem: The following is simplified problem. V[(i,t)] is decision variable and S[i] is input. I want to know if the obj increases or reduces when increasing one unit of S[i]`. I know may the shadow price and marginal cost are for decision variable not inputs. In Gurobi, Dual value (also known as the shadow price) can use the Pi function. for t in range(T): for i in range(I): m.addConstr(V[(i,t)]

GCC Inline Assembler “memory” Clobber don't prevent from re-arrange the code in ARM

时光总嘲笑我的痴心妄想 提交于 2021-02-10 06:14:04
问题 I read article about GCC Inline Assembler (http://www.ethernut.de/en/documents/arm-inline-asm.html). In this article, "memory" Clobber forces the compiler to store all cached values before and reload them after executing the assembler instructions. And it must retain the sequence. this is the example. The following code intends to multiply c with b, of which one or both may be modified by an interrupt routine. Disabling interrupts before accessing the variables and re-enable them afterwards

Efficient SSE FP `floor()` / `ceil()` / `round()` Rounding Functions Without SSE4.1?

我怕爱的太早我们不能终老 提交于 2021-02-10 04:13:39
问题 How can I round a __m128 vector of floats up/down or to the nearest integer, like these functions? Round - roundf() Ceil - ceilf() or SSE4.1 _mm_ceil_ps . Floor - floorf() or SSE4.1 _mm_floor_ps . I need to do this without SSE4.1 roundps ( _mm_floor_ps / _mm_ceil_ps / _mm_round_ps(x, _MM_FROUND_TO_NEAREST_INT |_MM_FROUND_NO_EXC) . roundps can also truncate toward zero, but I don't need that for this application. I can use SSE3 and earlier. (No SSSE3 or SSE4) So the function declaration would

Efficient SSE FP `floor()` / `ceil()` / `round()` Rounding Functions Without SSE4.1?

假装没事ソ 提交于 2021-02-10 04:13:30
问题 How can I round a __m128 vector of floats up/down or to the nearest integer, like these functions? Round - roundf() Ceil - ceilf() or SSE4.1 _mm_ceil_ps . Floor - floorf() or SSE4.1 _mm_floor_ps . I need to do this without SSE4.1 roundps ( _mm_floor_ps / _mm_ceil_ps / _mm_round_ps(x, _MM_FROUND_TO_NEAREST_INT |_MM_FROUND_NO_EXC) . roundps can also truncate toward zero, but I don't need that for this application. I can use SSE3 and earlier. (No SSSE3 or SSE4) So the function declaration would

Efficient SSE FP `floor()` / `ceil()` / `round()` Rounding Functions Without SSE4.1?

天大地大妈咪最大 提交于 2021-02-10 04:08:30
问题 How can I round a __m128 vector of floats up/down or to the nearest integer, like these functions? Round - roundf() Ceil - ceilf() or SSE4.1 _mm_ceil_ps . Floor - floorf() or SSE4.1 _mm_floor_ps . I need to do this without SSE4.1 roundps ( _mm_floor_ps / _mm_ceil_ps / _mm_round_ps(x, _MM_FROUND_TO_NEAREST_INT |_MM_FROUND_NO_EXC) . roundps can also truncate toward zero, but I don't need that for this application. I can use SSE3 and earlier. (No SSSE3 or SSE4) So the function declaration would

Efficient SSE FP `floor()` / `ceil()` / `round()` Rounding Functions Without SSE4.1?

牧云@^-^@ 提交于 2021-02-10 04:05:20
问题 How can I round a __m128 vector of floats up/down or to the nearest integer, like these functions? Round - roundf() Ceil - ceilf() or SSE4.1 _mm_ceil_ps . Floor - floorf() or SSE4.1 _mm_floor_ps . I need to do this without SSE4.1 roundps ( _mm_floor_ps / _mm_ceil_ps / _mm_round_ps(x, _MM_FROUND_TO_NEAREST_INT |_MM_FROUND_NO_EXC) . roundps can also truncate toward zero, but I don't need that for this application. I can use SSE3 and earlier. (No SSSE3 or SSE4) So the function declaration would