Skip to content

Documentation of decision vector variable types ordering #176

@juan11iguel

Description

@juan11iguel

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions