humoto
constraints_base.h
Go to the documentation of this file.
1 /**
2  @file
3  @author Alexander Sherikov
4  @copyright 2014-2017 INRIA. Licensed under the Apache License, Version 2.0.
5  (see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
6 
7  @brief
8 */
9 
10 #pragma once
11 
12 namespace humoto
13 {
14  namespace constraints
15  {
16  /**
17  * @brief Constraint type
18  */
20  {
21  public:
22  enum Type
23  {
24  UNDEFINED = 0,
25  ILU = 1, // L <= x[I] <= U
26  IL = 2, // L <= x[I]
27  IU = 3, // x[I] <= U
28  IB = 4, // x[I] = B
29  IB0 = 5, // x[I] = 0
30  GILU = 6, // L <= diag(G) * x[I] <= U
31  GIL = 7, // L <= diag(G) * x[I]
32  GIU = 8, // diag(G) * x[I] <= U
33  GIB = 9, // diag(G) * x[I] = B
34  GIB0 = 10, // diag(G) * x[I] = 0
35  ALU = 11, // L <= A * x <= U
36  AL = 12, // L <= A * x
37  AU = 13, // A * x <= U
38  AB = 14, // A * x = B
39  AB0 = 15, // A * x = 0
40  ASLU = 16, // L <= A * S * x <= U
41  ASL = 17, // L <= A * S * x
42  ASU = 18, // A * S * x <= U
43  ASB = 19, // A * S * x = B
44  ASB0 = 20 // A * S * x = 0
45  };
46 
47 
48  static bool isEquality(const Type ctr_type)
49  {
50  switch(ctr_type)
51  {
52  case IB:
53  case IB0:
54  case GIB:
55  case GIB0:
56  case AB:
57  case AB0:
58  case ASB:
59  case ASB0:
60  return(true);
61  case UNDEFINED:
62  HUMOTO_THROW_MSG("Uninitialized constraint type.");
63  default:
64  return(false);
65  }
66  }
67 
68  static bool isSimple(const Type ctr_type)
69  {
70  switch(ctr_type)
71  {
72  case ILU:
73  case IL:
74  case IU:
75  case IB:
76  case IB0:
77  case GILU:
78  case GIL:
79  case GIU:
80  case GIB:
81  case GIB0:
82  return(true);
83  case UNDEFINED:
84  HUMOTO_THROW_MSG("Uninitialized constraint type.");
85  default:
86  return(false);
87  }
88  }
89 
90 
91  static bool isTwoSidedInequality(const Type ctr_type)
92  {
93  switch(ctr_type)
94  {
95  case ILU:
96  case GILU:
97  case ALU:
98  case ASLU:
99  return(true);
100  case UNDEFINED:
101  HUMOTO_THROW_MSG("Uninitialized constraint type.");
102  default:
103  return(false);
104  }
105  }
106  };
107 
108 
109  // ======================================================================================
110  // ======================================================================================
111  // ======================================================================================
112 
113 
114  /**
115  * @brief Constraints abstract interface class
116  */
118  {
119  protected:
120  std::size_t number_of_variables_;
121 
122 
123  protected:
124  /**
125  * @brief Protected destructor: prevent destruction of the child
126  * classes through a base pointer.
127  */
129 
130 
132  {
133  number_of_variables_ = 0;
134  }
135 
136 
137  /**
138  * @brief Set number of variables
139  *
140  * @param[in] number_of_variables number of variables
141  */
142  void setNumberOfVariables(const std::size_t number_of_variables)
143  {
144  number_of_variables_ = number_of_variables;
145  }
146 
147 
148  /**
149  * @brief Reset body of constraints (matrix A or I)
150  *
151  * @param[in] number_of_constraints number of constraints
152  * @param[in] initialize_matrices initialize matrices using defaults
153  */
154  virtual void resetBody( const std::size_t number_of_constraints = 0,
155  const bool initialize_matrices = false) = 0;
156 
157 
158  /**
159  * @brief Reset bounds of constraints (b, lb, ub)
160  *
161  * @param[in] number_of_constraints number of constraints
162  * @param[in] initialize_matrices initialize matrices using defaults
163  */
164  virtual void resetBounds( const std::size_t number_of_constraints = 0,
165  const bool initialize_matrices = false) = 0;
166 
167 
168  /**
169  * @brief Initialize constraints
170  *
171  * @param[in] number_of_constraints number of constraints
172  * @param[in] number_of_variables number of variables
173  * @param[in] initialize_matrices initialize matrices using defaults
174  */
175  void reset (const std::size_t number_of_constraints = 0,
176  const std::size_t number_of_variables = 0,
177  const bool initialize_matrices = false)
178  {
179  setNumberOfVariables(number_of_variables);
180 
181  resetBody(number_of_constraints, initialize_matrices);
182  resetBounds(number_of_constraints, initialize_matrices);
183  }
184 
185 
186  /**
187  * @brief Log body.
188  *
189  * @param[in,out] logger logger
190  * @param[in] parent parent
191  * @param[in] name name
192  */
193  virtual void logBody(humoto::Logger &logger HUMOTO_GLOBAL_LOGGER_IF_DEFINED,
194  const LogEntryName &parent = LogEntryName(),
195  const std::string &name = "constraints") const = 0;
196 
197  /**
198  * @brief Log bounds.
199  *
200  * @param[in,out] logger logger
201  * @param[in] parent parent
202  * @param[in] name name
203  */
204  virtual void logBounds( humoto::Logger &logger HUMOTO_GLOBAL_LOGGER_IF_DEFINED,
205  const LogEntryName &parent = LogEntryName(),
206  const std::string &name = "constraints") const = 0;
207 
208 
209  public:
210  /**
211  * @brief Returns number of variables in the task.
212  *
213  * @return number of variables
214  */
215  std::size_t getNumberOfVariables() const
216  {
217  return (number_of_variables_);
218  }
219 
220 
221 
222  /**
223  * @brief Returns number of constraints in the task.
224  *
225  * @return number of constraints
226  */
227  virtual std::size_t getNumberOfConstraints() const = 0;
228 
229 
230 
231  /**
232  * @brief Log data.
233  *
234  * @param[in,out] logger logger
235  * @param[in] parent parent
236  * @param[in] name name
237  */
238  void log( humoto::Logger &logger HUMOTO_GLOBAL_LOGGER_IF_DEFINED,
239  const LogEntryName &parent = LogEntryName(),
240  const std::string &name = "constraints") const
241  {
242  LogEntryName subname = parent;
243  subname.add(name);
244 
245  logger.log(LogEntryName(subname).add("number_of_variables"), number_of_variables_);
246 
247  logBody(logger, subname, "");
248  logBounds(logger, subname, "");
249  }
250 
251 
252  /**
253  * @brief Computes location of the copied constraints in a
254  * container and verifies their consistency.
255  *
256  * @param[in] number_of_constraints number of added constraints
257  * @param[in] constraints_offset offset in the container
258  * @param[in] number_of_variables number of variables in the container
259  *
260  * @return Location
261  */
262  Location getCopyLocation(const std::size_t number_of_constraints,
263  const std::size_t constraints_offset,
264  const std::size_t number_of_variables) const
265  {
266  Location ctr_location(constraints_offset, number_of_constraints);
267 
268  HUMOTO_ASSERT( ctr_location.checkLength(getNumberOfConstraints()),
269  "Added constraints exceed preallocated storage space.");
270  HUMOTO_ASSERT( getNumberOfVariables() == number_of_variables,
271  "Constraints have mismatching number of variables.")
272 
273  return (ctr_location);
274  }
275  };
276 
277 
278 
279  /**
280  * @brief Container for general inequality constraints.
281  */
282  class HUMOTO_LOCAL ContainerALU : public BodyAMixin< BoundsLUMixin <ContainerBase> >
283  {
284  public:
285  using ContainerBase::reset;
286  };
287 
288 
289  /**
290  * @brief Container for general onesided inequality constraints.
291  */
292  class HUMOTO_LOCAL ContainerAL : public BodyAMixin< BoundsLMixin <ContainerBase> >
293  {
294  public:
295  using ContainerBase::reset;
296  };
297 
298 
299  /**
300  * @brief Container for general equality constraints.
301  */
302  class HUMOTO_LOCAL ContainerAB : public BodyAMixin< BoundsBMixin <ContainerBase> >
303  {
304  public:
305  using ContainerBase::reset;
306  };
307 
308 
309  /**
310  * @brief Container for simple inequality constraints.
311  */
312  class HUMOTO_LOCAL ContainerILU : public BodyIMixin< BoundsLUMixin <ContainerBase> >
313  {
314  public:
315  using ContainerBase::reset;
316 
317 
318  /**
319  * @brief Generates LB and UB, such that 'LB <= X <= UB'
320  *
321  * @param[out] lb
322  * @param[out] ub
323  */
324  void initializeSolutionBounds(Eigen::VectorXd &lb, Eigen::VectorXd &ub) const
325  {
326  if (getNumberOfConstraints() == 0)
327  {
328  lb.resize(0);
329  ub.resize(0);
330  }
331  else
332  {
333  lb.setConstant(number_of_variables_, -humoto::g_infinity);
334  ub.setConstant(number_of_variables_, humoto::g_infinity);
335 
336  for (std::size_t i = 0; i < getNumberOfConstraints(); ++i)
337  {
338  unsigned int variable_index = getIndices()[i];
339 
340  if (lb[variable_index] < getLowerBounds()[i])
341  {
342  lb[variable_index] = getLowerBounds()[i];
343  }
344 
345  if (ub[variable_index] > getUpperBounds()[i])
346  {
347  ub[variable_index] = getUpperBounds()[i];
348  }
349 
350 #ifndef DNDEBUG
351  if (lb[variable_index] > ub[variable_index])
352  {
353  std::stringstream err_msg;
354  err_msg << std::setprecision(std::numeric_limits<double>::digits10);
355  err_msg << "Inconsistent bounds (lb > ub): variable index = '" << variable_index
356  << "', lb = '" << lb[variable_index]
357  << "', ub = '" << ub[variable_index]
358  << "'.";
359  HUMOTO_THROW_MSG(err_msg.str());
360  }
361 #endif
362  }
363  }
364  }
365  };
366 
367 
368  // ======================================================================================
369  // ======================================================================================
370  // ======================================================================================
371 
372 
373  /**
374  * @brief Constraints abstract interface class
375  */
377  {
378  protected:
379  /**
380  * @brief Protected destructor: prevent destruction of the child
381  * classes through a base pointer.
382  */
384 
385 
387  {
388  number_of_variables_ = 0;
389  }
390 
391 
392  public:
393  /**
394  * @brief Copy bounds to given vectors
395  *
396  * @param[in] lb
397  * @param[in] ub
398  * @param[in] location offset and length
399  */
400  virtual void copyBoundsTo( Eigen::VectorXd & lb,
401  Eigen::VectorXd & ub,
402  const Location & location) const = 0;
403 
404  /**
405  * @brief Copy body to the given matrix
406  *
407  * @param[in] A
408  * @param[in] location offset and length
409  */
410  virtual void copyBodyTo(Eigen::MatrixXd & A,
411  const Location & location) const = 0;
412 
413 
414  /**
415  * @brief Copy negated body to the given matrix
416  *
417  * @param[in] A
418  * @param[in] location offset and length
419  */
420  virtual void copyNegativeBodyTo(Eigen::MatrixXd & A,
421  const Location & location) const = 0;
422 
423 
424  /**
425  * @brief Compute 'A^T * A' for general equality constaints and
426  * save or add the result to H. Compute 'A^T * b' for general
427  * equality constaints and save or add the result to g.
428  *
429  * @param[in,out] H left lower triangular part of the result.
430  * @param[in,out] g result
431  *
432  * @attention Only the left lower triangular part of H is formed.
433  * Apply appropriate conversion with
434  * etools::convertLLTtoSymmetric() before using H.
435  */
436  virtual void getATAandATb(Eigen::MatrixXd &H, Eigen::VectorXd &g) const
437  {
438  HUMOTO_THROW_MSG("Operation not supported.");
439  }
440 
441 
442  /// @copydoc getATAandATb
443  virtual void addATAandATb(Eigen::MatrixXd &H, Eigen::VectorXd &g) const
444  {
445  HUMOTO_THROW_MSG("Operation not supported.");
446  }
447 
448 
449  /**
450  * @brief Set constraints.
451  *
452  * @param[in,out] container new constraints
453  * @param[in] constraints_offset first row offset
454  *
455  * @return offset of the end of added constraints
456  */
457  virtual std::size_t copyTo( ContainerILU & container,
458  const std::size_t constraints_offset) const
459  {
460  HUMOTO_THROW_MSG("Operation not supported.");
461  }
462 
463 
464  /**
465  * @brief Copy constraints to a container
466  *
467  * @param[in,out] container
468  * @param[in] constraints_offset first row offset
469  *
470  * @return offset of the end of added constraints
471  */
472  virtual std::size_t copyTo( ContainerAL & container,
473  const std::size_t constraints_offset) const
474  {
475  HUMOTO_THROW_MSG("Operation not supported.");
476  }
477 
478 
479  /**
480  * @brief Copy constraints to a container
481  *
482  * @param[in,out] container
483  * @param[in] constraints_offset first row offset
484  *
485  * @return offset of the end of added constraints
486  */
487  virtual std::size_t copyTo( ContainerAB & container,
488  const std::size_t constraints_offset) const
489  {
490  HUMOTO_THROW_MSG("Operation not supported.");
491  }
492 
493 
494  /**
495  * @brief Copy constraints to a container
496  *
497  * @param[in,out] container
498  * @param[in] constraints_offset first row offset
499  *
500  * @return offset of the end of added constraints
501  */
502  virtual std::size_t copyTo( ContainerALU & container,
503  const std::size_t constraints_offset) const
504  {
505  HUMOTO_THROW_MSG("Operation not supported.");
506  }
507 
508 
509  /**
510  * @brief Returns type of the constraints
511  *
512  * @return type of the constraints
513  */
514  virtual ConstraintType::Type getType() const = 0;
515 
516 
517 
518  /**
519  * @brief Check properties of the constriaints
520  *
521  * @return true/false
522  */
523  bool isEquality() const
524  {
525  return (ConstraintType::isEquality(getType()));
526  }
527 
528  /// @copydoc isEquality
529  bool isSimple() const
530  {
531  return (ConstraintType::isSimple(getType()));
532  }
533 
534  /// @copydoc isEquality
535  bool isTwoSidedInequality() const
536  {
537  return (ConstraintType::isTwoSidedInequality(getType()));
538  }
539 
540 
541  /**
542  * @brief Check consistency of the constraints
543  */
544  virtual void checkConsistency() const = 0;
545 
546 
547 
548  /**
549  * @brief Determine active set given a solution vector
550  *
551  * @param[in,out] active_set active set
552  * @param[in] location location of the constraints in the active set
553  * @param[in] solution solution vector
554  */
555  virtual void determineActiveSet(ActiveSetConstraints & active_set,
556  const Location & location,
557  const Solution & solution) const = 0;
558 
559  /**
560  * @brief Compute violations given a solution vector
561  *
562  * @param[in,out] violations violations
563  * @param[in] location location of the constraints in the active set
564  * @param[in] solution solution vector
565  */
566  virtual void computeViolations( ViolationsConstraints & violations,
567  const Location & location,
568  const Solution & solution) const = 0;
569  };
570 
571 
572  // ======================================================================================
573  // ======================================================================================
574  // ======================================================================================
575 
576 
577  /**
578  * @defgroup ConstraintsToContainerCopy Copying of constraints to containers
579  *
580  * @ingroup ConstraintsImplementation
581  *
582  * A set of mixins which implement functionality for copying of
583  * constraints to containers.
584  */
585 
586  /**
587  * @addtogroup ConstraintsToContainerCopy
588  * @{
589  */
590 
591  /**
592  * @brief This mixin provides functionality for conversion of specific type
593  * of constraints to a certain container.
594  *
595  * @tparam t_Base Base class: @ref humoto::constraints::ConstraintsBase or
596  * @ref humoto::TaskBase wrapped with other mixins.
597  *
598  */
599  template<class t_Base>
601  {
602  protected:
603  /**
604  * @brief Protected destructor: prevent destruction of the child
605  * classes through a base pointer.
606  */
609 
610  public:
611  using t_Base::copyTo;
612 
613 
614  /// @copydoc humoto::constraints::ConstraintsBase::copyTo
615  std::size_t copyTo( ContainerALU & container,
616  const std::size_t constraints_offset) const
617  {
618  Location ctr_location = container.getCopyLocation( t_Base::getNumberOfConstraints(),
619  constraints_offset,
620  container.getNumberOfVariables());
621 
622  t_Base::copyBoundsTo(container.getLowerBounds(), container.getUpperBounds(), ctr_location);
623  t_Base::copyBodyTo(container.getA(), ctr_location);
624 
625  return (ctr_location.offset_ + ctr_location.length_);
626  }
627  };
628 
629 
630 
631  /// @copydoc CopyAnyToALUMixin
632  template<class t_Base>
634  {
635  protected:
636  /**
637  * @brief Protected destructor: prevent destruction of the child
638  * classes through a base pointer.
639  */
642 
643  public:
644  using t_Base::copyTo;
645 
646 
647  /// @copydoc humoto::constraints::ConstraintsBase::copyTo
648  virtual std::size_t copyTo( ContainerAL & container,
649  const std::size_t constraints_offset) const
650  {
651  Location ctr_location = container.getCopyLocation( t_Base::getNumberOfConstraints(),
652  constraints_offset,
653  container.getNumberOfVariables());
654 
655  container.getLowerBounds().segment(ctr_location.offset_, ctr_location.length_) = t_Base::getLowerBounds();
656  t_Base::copyBodyTo(container.getA(), ctr_location);
657 
658  return (ctr_location.offset_ + ctr_location.length_);
659  }
660  };
661 
662 
663  /// @copydoc CopyAnyToALUMixin
664  template<class t_Base>
666  {
667  protected:
668  /**
669  * @brief Protected destructor: prevent destruction of the child
670  * classes through a base pointer.
671  */
674 
675  public:
676  using t_Base::copyTo;
677 
678 
679  /// @copydoc humoto::constraints::ConstraintsBase::copyTo
680  virtual std::size_t copyTo( ContainerAL & container,
681  const std::size_t constraints_offset) const
682  {
683  Location ctr_location = container.getCopyLocation( t_Base::getNumberOfConstraints(),
684  constraints_offset,
685  container.getNumberOfVariables());
686 
687  container.getLowerBounds().segment(ctr_location.offset_, ctr_location.length_) = -t_Base::getUpperBounds();
688  t_Base::copyNegativeBodyTo(container.getA(), ctr_location);
689 
690  return (ctr_location.offset_ + ctr_location.length_);
691  }
692  };
693 
694 
695  /// @copydoc CopyAnyToALUMixin
696  template<class t_Base>
698  : public CopyUpperInequalityToALMixin< CopyLowerInequalityToALMixin<t_Base> >
699  {
700  protected:
701  /**
702  * @brief Protected destructor: prevent destruction of the child
703  * classes through a base pointer.
704  */
707 
708  public:
709  using t_Base::copyTo;
710 
711 
712  /// @copydoc humoto::constraints::ConstraintsBase::copyTo
713  std::size_t copyTo( ContainerAL & container,
714  const std::size_t constraints_offset) const
715  {
716  return(
718  container,
720  constraints_offset))
721  );
722  }
723  };
724 
725 
726  /// @copydoc CopyAnyToALUMixin
727  template<class t_Base>
729  {
730  protected:
731  /**
732  * @brief Protected destructor: prevent destruction of the child
733  * classes through a base pointer.
734  */
737 
738  public:
739  using t_Base::copyTo;
740 
741 
742  /// @copydoc humoto::constraints::ConstraintsBase::copyTo
743  std::size_t copyTo( ContainerILU & container,
744  const std::size_t constraints_offset) const
745  {
746  Location ctr_location = container.getCopyLocation( t_Base::getNumberOfConstraints(),
747  constraints_offset,
748  container.getNumberOfVariables());
749 
750  t_Base::copyBoundsTo(container.getLowerBounds(), container.getUpperBounds(), ctr_location);
751 
752  // copy indices or A
753  container.getIndices().segment(ctr_location.offset_, ctr_location.length_) = t_Base::getIndices();
754 
755  return (ctr_location.offset_ + ctr_location.length_);
756  }
757  };
758 
759 
760  /// @copydoc CopyAnyToALUMixin
761  template<class t_Base>
763  {
764  protected:
765  /**
766  * @brief Protected destructor: prevent destruction of the child
767  * classes through a base pointer.
768  */
771 
772  public:
773  using t_Base::copyTo;
774 
775 
776  /// @copydoc humoto::constraints::ConstraintsBase::copyTo
777  std::size_t copyTo( ContainerAB & container,
778  const std::size_t constraints_offset) const
779  {
780  Location ctr_location = container.getCopyLocation( t_Base::getNumberOfConstraints(),
781  constraints_offset,
782  container.getNumberOfVariables());
783 
784  t_Base::copyEqualityBoundsTo(container.getB(), ctr_location);
785  t_Base::copyBodyTo(container.getA(), ctr_location);
786 
787  return (ctr_location.offset_ + ctr_location.length_);
788  }
789  };
790  /// @}
791  }
792 }
793 
794 
Container for simple inequality constraints.
virtual std::size_t copyTo(ContainerALU &container, const std::size_t constraints_offset) const
Copy constraints to a container.
Constraints abstract interface class.
bool checkLength(const std::size_t max_length) const
Check length of location.
Definition: utility.h:208
Violations corresponding to Constraints class.
Definition: violations.h:17
Eigen::VectorXd & getB()
Get vector b from equalities: &#39;A*x = b&#39; or &#39;x = b&#39;.
~CopyTwoSidedInequalityToALMixin()
Protected destructor: prevent destruction of the child classes through a base pointer.
bool isEquality() const
Check properties of the constriaints.
~ContainerBase()
Protected destructor: prevent destruction of the child classes through a base pointer.
#define HUMOTO_LOCAL
Definition: export_import.h:26
virtual std::size_t copyTo(ContainerAL &container, const std::size_t constraints_offset) const
Copy constraints to a container.
void setNumberOfVariables(const std::size_t number_of_variables)
Set number of variables.
std::size_t getNumberOfVariables() const
Returns number of variables in the task.
~CopySimpleToILUMixin()
Protected destructor: prevent destruction of the child classes through a base pointer.
const double g_infinity
Infinity.
Definition: constants.h:24
Mixin representing matrix of indices &#39;I&#39; in a simple constraint.
#define HUMOTO_GLOBAL_LOGGER_IF_DEFINED
Definition: logger.h:997
#define HUMOTO_ASSERT(condition, message)
static bool isSimple(const Type ctr_type)
humoto::IndexVector & getIndices()
Get indices.
Container of the solution.
Definition: solution.h:176
Active set corresponding to Constraints class.
Definition: active_set.h:43
~CopyLowerInequalityToALMixin()
Protected destructor: prevent destruction of the child classes through a base pointer.
#define HUMOTO_THROW_MSG(s)
HUMOTO_THROW_MSG throws an error message concatenated with the name of the function (if supported)...
Represents log entry name.
Definition: logger.h:169
bool isSimple() const
Check properties of the constriaints.
virtual std::size_t copyTo(ContainerAL &container, const std::size_t constraints_offset) const
Set constraints.
void reset(const std::size_t number_of_constraints=0, const std::size_t number_of_variables=0, const bool initialize_matrices=false)
Initialize constraints.
std::size_t length_
Definition: utility.h:150
virtual std::size_t copyTo(ContainerAB &container, const std::size_t constraints_offset) const
Copy constraints to a container.
This mixin provides functionality for conversion of specific type of constraints to a certain contain...
Eigen::VectorXd & getUpperBounds()
Get upper bounds (ub vectors from &#39;A*x <= ub&#39;).
~CopyUpperInequalityToALMixin()
Protected destructor: prevent destruction of the child classes through a base pointer.
Eigen::MatrixXd & getA()
Get matrix A from general constraints: &#39;A*x = b&#39;, &#39;lb <= A*x <= ub&#39;.
~CopyAnyToALUMixin()
Protected destructor: prevent destruction of the child classes through a base pointer.
virtual void addATAandATb(Eigen::MatrixXd &H, Eigen::VectorXd &g) const
Compute &#39;A^T * A&#39; for general equality constaints and save or add the result to H. Compute &#39;A^T * b&#39; for general equality constaints and save or add the result to g.
std::size_t copyTo(ContainerAL &container, const std::size_t constraints_offset) const
Set constraints.
This mixin provides functionality for conversion of specific type of constraints to a certain contain...
Threaded logger: any data sent to this logger is wrapped in a message and pushed to a queue...
Definition: logger.h:555
void initializeSolutionBounds(Eigen::VectorXd &lb, Eigen::VectorXd &ub) const
Generates LB and UB, such that &#39;LB <= X <= UB&#39;.
~CopyEqualityToABMixin()
Protected destructor: prevent destruction of the child classes through a base pointer.
std::size_t copyTo(ContainerALU &container, const std::size_t constraints_offset) const
Set constraints.
std::size_t copyTo(ContainerAB &container, const std::size_t constraints_offset) const
Set constraints.
bool isTwoSidedInequality() const
Check properties of the constriaints.
This mixin provides functionality for conversion of specific type of constraints to a certain contain...
Location getCopyLocation(const std::size_t number_of_constraints, const std::size_t constraints_offset, const std::size_t number_of_variables) const
Computes location of the copied constraints in a container and verifies their consistency.
Container for general onesided inequality constraints.
The root namespace of HuMoTo.
Definition: config.h:12
std::size_t copyTo(ContainerILU &container, const std::size_t constraints_offset) const
Set constraints.
virtual std::size_t copyTo(ContainerAL &container, const std::size_t constraints_offset) const
Set constraints.
virtual void getATAandATb(Eigen::MatrixXd &H, Eigen::VectorXd &g) const
Compute &#39;A^T * A&#39; for general equality constaints and save or add the result to H. Compute &#39;A^T * b&#39; for general equality constaints and save or add the result to g.
~ConstraintsBase()
Protected destructor: prevent destruction of the child classes through a base pointer.
void log(humoto::Logger &logger, const LogEntryName &parent=LogEntryName(), const std::string &name="constraints") const
Log data.
Container for general equality constraints.
Mixin representing matrix &#39;A&#39; in a general constraint.
LogEntryName & add(const char *name)
extends entry name with a subname
Definition: logger.h:232
Location of a data chunk (offset + length).
Definition: utility.h:146
static bool isEquality(const Type ctr_type)
Eigen::VectorXd & getLowerBounds()
Get lower bounds (lb/ub vectors from &#39;lb <= A*x <= ub&#39;).
This mixin provides functionality for conversion of specific type of constraints to a certain contain...
std::size_t offset_
Definition: utility.h:149
This mixin provides functionality for conversion of specific type of constraints to a certain contain...
static bool isTwoSidedInequality(const Type ctr_type)
virtual std::size_t copyTo(ContainerILU &container, const std::size_t constraints_offset) const
Set constraints.
This mixin provides functionality for conversion of specific type of constraints to a certain contain...
Container for general inequality constraints.
Constraints abstract interface class.