Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
ortools.math_opt.python.normalize Namespace Reference

Functions

None math_opt_normalize_proto (message.Message protobuf_message)
 

Detailed Description

Utility functions for normalizing proto3 message objects in Python.

Function Documentation

◆ math_opt_normalize_proto()

None ortools.math_opt.python.normalize.math_opt_normalize_proto ( message.Message protobuf_message)
Clears all non-duration submessages that are not in one_ofs.

A message is considered `empty` if:
  * every non-optional scalar fields has its default value,
  * every optional scalar field is unset,
  * every repeated/map fields is empty
  * every oneof is unset,
  * every duration field is unset
  * all other message fields (singular, not oneof, not duration) are `empty`.
This function clears all `empty` fields from `message`.

This is useful for testing.

Args:
  protobuf_message: The Message object to clear.

Definition at line 28 of file normalize.py.