Comments (2)
If your parameters are just constant values then it is better not to use parameters but pass the values using anonymous functions. Parameters are also optimization variables that you can set bounds on them, so they are not efficient for constants.
You can see how to do it in this example:
https://github.com/OpenOCL/OpenOCL/blob/master/%2Bocl/%2Bexamples/ballandbeam.m
All the constants are stored in a struct conf
. You can pass a anonymous function to the solver like (for the system synamics):
@(dh,x,z,u,p) odefun(dh,x,z,u,p,conf);
and so odefun has conf
as an input.
function odefun(dh, x, z, u, p, conf)
...
end
If you are unfamiliar with anonymous functions, i can try to explain in more detail!
You can also use the parameters but it will be not efficient. And you can not use struct, but add them one by one:
sh.addParameter('p')
sh.addParameter('R0')
etc.
from openocl.
note that we introduced the userdata
field to pass constant parameters/values/structs..
See:
https://github.com/OpenOCL/OpenOCL/blob/v7.03/%2Bocl/%2Bexamples/ballandbeam.m
from openocl.
Related Issues (20)
- could setParameter work with struct
- Parameter bound on last gridpoint
- interpolation HOT 3
- setBounds, setInitialBounds, setEndBounds for ocl.Stage
- Version 7 - 'userdata' is not a recognized parameter HOT 2
- Version 7 - soltion doesn't have filed algvars HOT 1
- Python HOT 1
- Add random disturbance HOT 2
- Initial guess constraint violation HOT 5
- Integration Method
- Formulating daefh for system with huge symbolic expression of dynamics
- Deal with Time-dependent pathcost?
- IPOPT options HOT 1
- Optimal solution infeasibility flag
- costate from NLP solver
- Algebraic constraint examples
- How to deal with external functions in function "daefun"
- Simulink compatibility
- User-input initial guess with getInitialGuessWithUserData()
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 openocl.