Comments (5)
Hi @cumttc,
You can pass a matrix of positions with shape (pop_size, n_dims) in a solver like this:
https://mealpy.readthedocs.io/en/latest/pages/general/advance_guide.html#starting-solutions
from mealpy.
Hi@thieupu
Hi @cumttc,
You can pass a matrix of positions with shape (pop_size, n_dims) in a solver like this: https://mealpy.readthedocs.io/en/latest/pages/general/advance_guide.html#starting-solutions
If my initial solution is [1, 2, 3, 4], then the 'starting_solutions' I need to pass in is np.ones((pop_size, 4)) @ np.diag(1, 2, 3, 4).
Is it correct?
from mealpy.
@cumttc ,
Mealpy is population-based algorithms, so the starting_solutions
of any algorithm is a matrix of population and problem size.
If your initial solution is [1, 2, 3, 4]. And you have pop_size = 10 (agents).
Then you should set starting_solutions
like this:
import numpy as np
pop_size = 10
problem_size = n_dims = 4
initial = np.array([1, 2, 3, 4])
starting = [ initial + np.random.uniform(-0.1, 0.1, n_dims) for _ in range(0, pop_size-1) ]
starting_solutions = np.array( [initial, ] + starting )
You should never set starting_solutions
with the same position for all agents. That is not a good practice.
from mealpy.
Thanks for the answer, but one more question:
What should I do if I have additional parameters that are not involved in the optimization, but need to be passed into the objective function?
from mealpy.
@cumttc ,
Then you should define a custom problem like this:
https://mealpy.readthedocs.io/en/latest/pages/general/advance_guide.html#custom-problem
You can pass anything you want into that class.
from mealpy.
Related Issues (20)
- Dynamic constraints HOT 2
- [BUG]: The implementation of 'HS' (OriginalHS) lead to an error when solving the Bukin's functions family HOT 1
- Requesting Squirrel search algorithm HOT 3
- [BUG]: ´IntegerVar´ doesn't correct floating point numbers HOT 1
- [BUG]: Walrus optimisation algorithm missing equations of feeding step HOT 1
- [BUG]: NotImplementedError in mealpy.swarm_based.AVOA.OriginalAVOA.solve
- Request for Addition of Algorithms to Mealpy Library HOT 2
- Mealpy + Neural Network (Optimize Neural Network Hyper-parameter) with K-Fold HOT 1
- [BUG]: Problem with negative fitness
- [BUG]: Issue in the documentation of the Mealpy library HOT 1
- [BUG]: Base GWO's code in the documentation is incorrect HOT 1
- [FEAT]: integer instead of float HOT 1
- [FEAT]:
- Want to increase the non-dominated sorting for multi-objectives
- In this example, we use SMA optimize to optimize the hyper-parameters of SVC model.[BUG]: HOT 4
- [BUG]: In your examples ->pytorch->linear_regression.py,exists a bug.
- [FEAT]: Explicit objective function evaluation limitation HOT 1
- [FEAT]: add start point to algorithms HOT 2
- [BUG]: HOT 1
- [BUG]: Type Error in example code HOT 1
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 mealpy.