Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation of decision vector variable types ordering #176

Open
juan11iguel opened this issue Dec 11, 2024 · 0 comments
Open

Documentation of decision vector variable types ordering #176

juan11iguel opened this issue Dec 11, 2024 · 0 comments

Comments

@juan11iguel
Copy link

juan11iguel commented Dec 11, 2024

Reading the documentation, it does state with mathematical notation ($\mathbf{lb}, \mathbf{ub} \in \mathbb R^{n_{cx}} \times \mathbb Z^{n_{ix}}$) that the decision vector is composed by real variables followed by the integer part, however I think it would be good to explicitly state this with words in the docs.

To verify the order matters (not that I did it by mistake at first and this is how I realised):

class Problem:
	def get_bounds(self, ) -> tuple[np.ndarray, np.ndarray]:

		# Some unoptimized code
		box_bounds_lower = [0, 0, ..., 0, 0.0, ..., 0.0]
		box_bounds_upper = [1, 1, ..., 1, 1.0, ..., 1.0]

		return box_bounds_lower, box_bounds_upper

# Integer dec. variables before real raises value error
prob = pg.problem(Problem())

# Output:
ValueError: 
function: check_problem_bounds
where: /root/install/pagmo2-2.19.0/src/problem.cpp, 104
what: An upper bound of the integer part of the decision vector is: 35.182177 and is not an integer.

By changing the bounds order, the error goes away:

	...
	def get_bounds(self, ) -> tuple[np.ndarray, np.ndarray]:
		return box_bounds_lower[::-1], box_bounds_upper[::-1]

prob = pg.problem(Problem())

# Output:
Problem name: SolarMED MINLP problem
	C++ class name: pybind11::object

	Global dimension:			78
	Integer dimension:			24
	Fitness dimension:			11
	Number of objectives:			1
	Equality constraints dimension:		0
	Inequality constraints dimension:	10
	Tolerances on constraints: [0, 0, 0, 0, 0, ... ]
	Lower bounds: [0, 0, 0, 0, 0, ... ]
	Upper bounds: [35.3206, 35.286, 35.1822, 0, 0, ... ]
	Has batch fitness evaluation: false

Also, I wonder if since the data types of the box-bounds already need to match the data type of the decision vector, if it would not be possible to support an arbitrary ordering of the decision vector.

Best regards,
Juanmi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant