Comments (14)
from nloptcontrol.jl.
@huckl3b3rry87
the error message is
┌ Warning: Ipopt finished with status Invalid_Number_Detected
└ @ Ipopt ~/.julia/packages/Ipopt/bYzBL/src/MPB_wrapper.jl:178
┌ Warning: Not solved to optimality, status: Error
└ @ JuMP ~/.julia/packages/JuMP/I7whV/src/nlp.jl:1283
┌ Warning: The solution is not Optimal
│
│ Setting: n.f.mpc.simFailed = [true, n.r.ocp.status]
└ @ NLOptControl ~/.julia/packages/NLOptControl/i4KEb/src/utils.jl:406
from nloptcontrol.jl.
from nloptcontrol.jl.
@huckl3b3rry87
I tried constraining c > 0.1.
No luck unfortunately...
from nloptcontrol.jl.
from nloptcontrol.jl.
from nloptcontrol.jl.
The code I tried:
using NLOptControl
n=define(
numStates=1, # b(t) wealth
numControls=1, # c(t) cons
X0=[10.0], # b(0)= 100.0
XF=[0.0], # b(tf)= 0.0 die w/o assets
CL=[1.1],CU=[100.], # make sure cons is >0
XL=[-50.0],XU=[50.0]
)
states!(n,[:b];descriptions=["b(t)"])
controls!(n,[:c];descriptions=["c(t)"])
dx=[:( (0.05) * b[j] - c[j] )]
dynamics!(n,dx)
# configure!(n;(:Nck=>[1000]),(:finalTimeDV=>false),(:tf=>10.0));
configure!(n;(:integrationScheme=>:trapezoidal),(:finalTimeDV=>false),(:tf=>10.0));
#configure!(n;(:finalTimeDV=>false),(:tf=>1.0));
#configure!(n;(:tf=>1.0));
obj=integrate!(n, :( -1.0 * exp(-.01*j) * log(c[j]) ) )
@NLobjective(n.ocp.mdl, Min, obj)
optimize!(n)
The Error Message:
Warning: Ipopt finished with status Invalid_Number_Detected
└ @ Ipopt ~/.julia/packages/Ipopt/bYzBL/src/MPB_wrapper.jl:178
┌ Warning: Not solved to optimality, status: Error
└ @ JuMP ~/.julia/packages/JuMP/I7whV/src/nlp.jl:1283
┌ Warning: The solution is not Optimal
│
│ Setting: n.f.mpc.simFailed = [true, n.r.ocp.status]
└ @ NLOptControl ~/.julia/packages/NLOptControl/i4KEb/src/utils.jl:406
from nloptcontrol.jl.
from nloptcontrol.jl.
Thanks! I was ready to give up, but now it works!
using NLOptControl
n=define(
numStates=1, numControls=1,
X0=[5.0], XF=[0.0], # b(0)= 100.0
CL=[0.0], CU=[50.0], # make sure cons is >0
XL=[-50.0],XU=[50.0]
)
states!(n,[:b];descriptions=["b(t)"])
controls!(n,[:c];descriptions=["c(t)"])
dx=[:( (0.01) * b[j] + 10.0 - c[j] )]
dynamics!(n,dx)
configure!(n;(:integrationScheme=>:trapezoidal),(:finalTimeDV=>false),(:tf=>10.0))
obj=integrate!(n, :( exp(-.04 * j) * log(c[j]) ) );
@NLobjective(n.ocp.mdl, Max, obj)
optimize!(n)
allPlots(n)
#
##########
from nloptcontrol.jl.
from nloptcontrol.jl.
- is it possible to set an inequality constraint so that a control is less than or equal to a state var?
u1[j] <= 0.25 * x2[j]
- is it possible to solve an infinite horizon model
tf=infinity
?
I can't find how in the docs?
from nloptcontrol.jl.
from nloptcontrol.jl.
I can't find examples using @NLConstraint in NLOptControl:
using NLOptControl;
n=define(
numStates=2, numControls=2,
X0=[5.0,0.0], XF=[0.01,0.0],
XL=[0.0,NaN], XU=[100.0,NaN],
CL=[0.01,-7.0], CU=[50.0,NaN]
)
states!(n,[:k,:b];descriptions=["k(t)","b(t)"])
controls!(n,[:c,:pmt];descriptions=["c(t)","pmt(t)"])
dx=[
:( (k[j]^(.75)) - 0.3 * k[j] - c[j] - pmt[j] ),
:( 0.01 * b[j] - pmt[j] )
]
dynamics!(n,dx)
configure!(n;
(:integrationScheme=>:trapezoidal),
(:finalTimeDV=>false),(:tf=>100.0))
#
@NLconstraint(n.ocp.NLcon, :( b[j] <= 0.5 * k[j]) ) # ERROR
#
obj=integrate!(n, :( exp(-.03 * j) * log(c[j]) ) );
@NLobjective(n.ocp.mdl, Max, obj)
optimize!(n)
allPlots(n)
What is the correct syntax for: @NLconstraint(n.ocp.NLcon, :( b[j] <= 0.5 * k[j]) )
?
from nloptcontrol.jl.
from nloptcontrol.jl.
Related Issues (20)
- Is it working on julia 1.0? HOT 1
- About nonlinear constrain HOT 1
- How to set the final destination as a hard constrain HOT 1
- enabling scaling of the states and controls HOT 2
- NLOptControl and KNITRO HOT 3
- Defining Dynamics Model HOT 1
- Starting point for optimization HOT 2
- Info about upcoming removal of packages in the General registry
- package not found with Pkg.add() HOT 1
- Julia 1.0+ not supported HOT 16
- Cannot install the NLOptControl package on Julia 0.6.4 HOT 7
- Is it possible to specify boundary conditions for the control function? HOT 1
- Key error HOT 15
- Docs: broken links
- ERROR: The following package names could not be resolved HOT 2
- Tutorial examples are not working HOT 1
- Vector-equation dynamics/objective?
- Failing to precompile with NLOptControl and JuMP HOT 3
- How to use the "saveData(n)" function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nloptcontrol.jl.