10from sys
import version_info
as _swig_python_version_info
12if __package__
or "." in __name__:
13 from .
import libconoptpy4
18 import builtins
as __builtin__
24 strthis =
"proxy of " + self.this.__repr__()
25 except __builtin__.Exception:
27 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
31 def set_instance_attr(self, name, value):
33 set(self, name, value)
34 elif name ==
"thisown":
36 elif hasattr(self, name)
and isinstance(getattr(type(self), name), property):
37 set(self, name, value)
39 raise AttributeError(
"You cannot add instance attributes to %s" % self)
40 return set_instance_attr
44 def set_class_attr(cls, name, value):
45 if hasattr(cls, name)
and not isinstance(getattr(cls, name), property):
48 raise AttributeError(
"You cannot add class attributes to %s" % cls)
53 """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
55 return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
60 """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
67 r"""Proxy of C++ swig::SwigPyIterator class."""
69 thisown = property(
lambda x: x.this.own(),
lambda x, v: x.this.own(v), doc=
"The membership flag")
72 raise AttributeError(
"No constructor defined - class is abstract")
74 __swig_destroy__ = libconoptpy4.delete_SwigPyIterator
77 r"""value(SwigPyIterator self) -> PyObject *"""
78 return libconoptpy4.SwigPyIterator_value(self)
82 incr(SwigPyIterator self, size_t n=1) -> SwigPyIterator
89 return libconoptpy4.SwigPyIterator_incr(self, n)
93 decr(SwigPyIterator self, size_t n=1) -> SwigPyIterator
100 return libconoptpy4.SwigPyIterator_decr(self, n)
104 distance(SwigPyIterator self, SwigPyIterator x) -> ptrdiff_t
108 x: swig::SwigPyIterator const &
111 return libconoptpy4.SwigPyIterator_distance(self, x)
115 equal(SwigPyIterator self, SwigPyIterator x) -> bool
119 x: swig::SwigPyIterator const &
122 return libconoptpy4.SwigPyIterator_equal(self, x)
125 r"""copy(SwigPyIterator self) -> SwigPyIterator"""
126 return libconoptpy4.SwigPyIterator_copy(self)
129 r"""next(SwigPyIterator self) -> PyObject *"""
130 return libconoptpy4.SwigPyIterator_next(self)
133 r"""__next__(SwigPyIterator self) -> PyObject *"""
134 return libconoptpy4.SwigPyIterator___next__(self)
137 r"""previous(SwigPyIterator self) -> PyObject *"""
138 return libconoptpy4.SwigPyIterator_previous(self)
140 def advance(self, n):
142 advance(SwigPyIterator self, ptrdiff_t n) -> SwigPyIterator
149 return libconoptpy4.SwigPyIterator_advance(self, n)
153 __eq__(SwigPyIterator self, SwigPyIterator x) -> bool
157 x: swig::SwigPyIterator const &
160 return libconoptpy4.SwigPyIterator___eq__(self, x)
164 __ne__(SwigPyIterator self, SwigPyIterator x) -> bool
168 x: swig::SwigPyIterator const &
171 return libconoptpy4.SwigPyIterator___ne__(self, x)
173 def __iadd__(self, n):
175 __iadd__(SwigPyIterator self, ptrdiff_t n) -> SwigPyIterator
182 return libconoptpy4.SwigPyIterator___iadd__(self, n)
184 def __isub__(self, n):
186 __isub__(SwigPyIterator self, ptrdiff_t n) -> SwigPyIterator
193 return libconoptpy4.SwigPyIterator___isub__(self, n)
195 def __add__(self, n):
197 __add__(SwigPyIterator self, ptrdiff_t n) -> SwigPyIterator
204 return libconoptpy4.SwigPyIterator___add__(self, n)
206 def __sub__(self, *args):
208 __sub__(SwigPyIterator self, ptrdiff_t n) -> SwigPyIterator
214 __sub__(SwigPyIterator self, SwigPyIterator x) -> ptrdiff_t
218 x: swig::SwigPyIterator const &
221 return libconoptpy4.SwigPyIterator___sub__(self, *args)
225# Register SwigPyIterator in libconoptpy4:
226libconoptpy4.SwigPyIterator_swigregister(SwigPyIterator)
227class IntVector(object):
228 r"""Proxy of C++ std::vector< int > class."""
230 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
231 __repr__ = _swig_repr
234 r"""iterator(IntVector self) -> SwigPyIterator"""
235 return libconoptpy4.IntVector_iterator(self)
237 return self.iterator()
239 def __nonzero__(self):
240 r"""__nonzero__(IntVector self) -> bool"""
241 return libconoptpy4.IntVector___nonzero__(self)
244 r"""__bool__(IntVector self) -> bool"""
245 return libconoptpy4.IntVector___bool__(self)
248 r"""__len__(IntVector self) -> std::vector< int >::size_type"""
249 return libconoptpy4.IntVector___len__(self)
251 def __getslice__(self, i, j):
253 __getslice__(IntVector self, std::vector< int >::difference_type i, std::vector< int >::difference_type j) -> IntVector
257 i: std::vector< int >::difference_type
258 j: std::vector< int >::difference_type
261 return libconoptpy4.IntVector___getslice__(self, i, j)
263 def __setslice__(self, *args):
265 __setslice__(IntVector self, std::vector< int >::difference_type i, std::vector< int >::difference_type j)
269 i: std::vector< int >::difference_type
270 j: std::vector< int >::difference_type
272 __setslice__(IntVector self, std::vector< int >::difference_type i, std::vector< int >::difference_type j, IntVector v)
276 i: std::vector< int >::difference_type
277 j: std::vector< int >::difference_type
278 v: std::vector< int,std::allocator< int > > const &
281 return libconoptpy4.IntVector___setslice__(self, *args)
283 def __delslice__(self, i, j):
285 __delslice__(IntVector self, std::vector< int >::difference_type i, std::vector< int >::difference_type j)
289 i: std::vector< int >::difference_type
290 j: std::vector< int >::difference_type
293 return libconoptpy4.IntVector___delslice__(self, i, j)
295 def __delitem__(self, *args):
297 __delitem__(IntVector self, std::vector< int >::difference_type i)
301 i: std::vector< int >::difference_type
303 __delitem__(IntVector self, SWIGPY_SLICEOBJECT * slice)
307 slice: SWIGPY_SLICEOBJECT *
310 return libconoptpy4.IntVector___delitem__(self, *args)
312 def __getitem__(self, *args):
314 __getitem__(IntVector self, SWIGPY_SLICEOBJECT * slice) -> IntVector
318 slice: SWIGPY_SLICEOBJECT *
320 __getitem__(IntVector self, std::vector< int >::difference_type i) -> std::vector< int >::value_type const &
324 i: std::vector< int >::difference_type
327 return libconoptpy4.IntVector___getitem__(self, *args)
329 def __setitem__(self, *args):
331 __setitem__(IntVector self, SWIGPY_SLICEOBJECT * slice, IntVector v)
335 slice: SWIGPY_SLICEOBJECT *
336 v: std::vector< int,std::allocator< int > > const &
338 __setitem__(IntVector self, SWIGPY_SLICEOBJECT * slice)
342 slice: SWIGPY_SLICEOBJECT *
344 __setitem__(IntVector self, std::vector< int >::difference_type i, std::vector< int >::value_type const & x)
348 i: std::vector< int >::difference_type
349 x: std::vector< int >::value_type const &
352 return libconoptpy4.IntVector___setitem__(self, *args)
355 r"""pop(IntVector self) -> std::vector< int >::value_type"""
356 return libconoptpy4.IntVector_pop(self)
360 append(IntVector self, std::vector< int >::value_type const & x)
364 x: std::vector< int >::value_type const &
367 return libconoptpy4.IntVector_append(self, x)
370 r"""empty(IntVector self) -> bool"""
371 return libconoptpy4.IntVector_empty(self)
374 r"""size(IntVector self) -> std::vector< int >::size_type"""
375 return libconoptpy4.IntVector_size(self)
379 swap(IntVector self, IntVector v)
383 v: std::vector< int > &
386 return libconoptpy4.IntVector_swap(self, v)
389 r"""begin(IntVector self) -> std::vector< int >::iterator"""
390 return libconoptpy4.IntVector_begin(self)
393 r"""end(IntVector self) -> std::vector< int >::iterator"""
394 return libconoptpy4.IntVector_end(self)
397 r"""rbegin(IntVector self) -> std::vector< int >::reverse_iterator"""
398 return libconoptpy4.IntVector_rbegin(self)
401 r"""rend(IntVector self) -> std::vector< int >::reverse_iterator"""
402 return libconoptpy4.IntVector_rend(self)
405 r"""clear(IntVector self)"""
406 return libconoptpy4.IntVector_clear(self)
408 def get_allocator(self):
409 r"""get_allocator(IntVector self) -> std::vector< int >::allocator_type"""
410 return libconoptpy4.IntVector_get_allocator(self)
413 r"""pop_back(IntVector self)"""
414 return libconoptpy4.IntVector_pop_back(self)
416 def erase(self, *args):
418 erase(IntVector self, std::vector< int >::iterator pos) -> std::vector< int >::iterator
422 pos: std::vector< int >::iterator
424 erase(IntVector self, std::vector< int >::iterator first, std::vector< int >::iterator last) -> std::vector< int >::iterator
428 first: std::vector< int >::iterator
429 last: std::vector< int >::iterator
432 return libconoptpy4.IntVector_erase(self, *args)
434 def __init__(self, *args):
436 __init__(IntVector self) -> IntVector
437 __init__(IntVector self, IntVector other) -> IntVector
441 other: std::vector< int > const &
443 __init__(IntVector self, std::vector< int >::size_type size) -> IntVector
447 size: std::vector< int >::size_type
449 __init__(IntVector self, std::vector< int >::size_type size, std::vector< int >::value_type const & value) -> IntVector
453 size: std::vector< int >::size_type
454 value: std::vector< int >::value_type const &
457 libconoptpy4.IntVector_swiginit(self, libconoptpy4.new_IntVector(*args))
459 def push_back(self, x):
461 push_back(IntVector self, std::vector< int >::value_type const & x)
465 x: std::vector< int >::value_type const &
468 return libconoptpy4.IntVector_push_back(self, x)
471 r"""front(IntVector self) -> std::vector< int >::value_type const &"""
472 return libconoptpy4.IntVector_front(self)
475 r"""back(IntVector self) -> std::vector< int >::value_type const &"""
476 return libconoptpy4.IntVector_back(self)
478 def assign(self, n, x):
480 assign(IntVector self, std::vector< int >::size_type n, std::vector< int >::value_type const & x)
484 n: std::vector< int >::size_type
485 x: std::vector< int >::value_type const &
488 return libconoptpy4.IntVector_assign(self, n, x)
490 def resize(self, *args):
492 resize(IntVector self, std::vector< int >::size_type new_size)
496 new_size: std::vector< int >::size_type
498 resize(IntVector self, std::vector< int >::size_type new_size, std::vector< int >::value_type const & x)
502 new_size: std::vector< int >::size_type
503 x: std::vector< int >::value_type const &
506 return libconoptpy4.IntVector_resize(self, *args)
508 def insert(self, *args):
510 insert(IntVector self, std::vector< int >::iterator pos, std::vector< int >::value_type const & x) -> std::vector< int >::iterator
514 pos: std::vector< int >::iterator
515 x: std::vector< int >::value_type const &
517 insert(IntVector self, std::vector< int >::iterator pos, std::vector< int >::size_type n, std::vector< int >::value_type const & x)
521 pos: std::vector< int >::iterator
522 n: std::vector< int >::size_type
523 x: std::vector< int >::value_type const &
526 return libconoptpy4.IntVector_insert(self, *args)
528 def reserve(self, n):
530 reserve(IntVector self, std::vector< int >::size_type n)
534 n: std::vector< int >::size_type
537 return libconoptpy4.IntVector_reserve(self, n)
540 r"""capacity(IntVector self) -> std::vector< int >::size_type"""
541 return libconoptpy4.IntVector_capacity(self)
542 __swig_destroy__ = libconoptpy4.delete_IntVector
544# Register IntVector in libconoptpy4:
545libconoptpy4.IntVector_swigregister(IntVector)
546class DoubleVector(object):
547 r"""Proxy of C++ std::vector< double > class."""
549 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
550 __repr__ = _swig_repr
553 r"""iterator(DoubleVector self) -> SwigPyIterator"""
554 return libconoptpy4.DoubleVector_iterator(self)
556 return self.iterator()
558 def __nonzero__(self):
559 r"""__nonzero__(DoubleVector self) -> bool"""
560 return libconoptpy4.DoubleVector___nonzero__(self)
563 r"""__bool__(DoubleVector self) -> bool"""
564 return libconoptpy4.DoubleVector___bool__(self)
567 r"""__len__(DoubleVector self) -> std::vector< double >::size_type"""
568 return libconoptpy4.DoubleVector___len__(self)
570 def __getslice__(self, i, j):
572 __getslice__(DoubleVector self, std::vector< double >::difference_type i, std::vector< double >::difference_type j) -> DoubleVector
576 i: std::vector< double >::difference_type
577 j: std::vector< double >::difference_type
580 return libconoptpy4.DoubleVector___getslice__(self, i, j)
582 def __setslice__(self, *args):
584 __setslice__(DoubleVector self, std::vector< double >::difference_type i, std::vector< double >::difference_type j)
588 i: std::vector< double >::difference_type
589 j: std::vector< double >::difference_type
591 __setslice__(DoubleVector self, std::vector< double >::difference_type i, std::vector< double >::difference_type j, DoubleVector v)
595 i: std::vector< double >::difference_type
596 j: std::vector< double >::difference_type
597 v: std::vector< double,std::allocator< double > > const &
600 return libconoptpy4.DoubleVector___setslice__(self, *args)
602 def __delslice__(self, i, j):
604 __delslice__(DoubleVector self, std::vector< double >::difference_type i, std::vector< double >::difference_type j)
608 i: std::vector< double >::difference_type
609 j: std::vector< double >::difference_type
612 return libconoptpy4.DoubleVector___delslice__(self, i, j)
614 def __delitem__(self, *args):
616 __delitem__(DoubleVector self, std::vector< double >::difference_type i)
620 i: std::vector< double >::difference_type
622 __delitem__(DoubleVector self, SWIGPY_SLICEOBJECT * slice)
626 slice: SWIGPY_SLICEOBJECT *
629 return libconoptpy4.DoubleVector___delitem__(self, *args)
631 def __getitem__(self, *args):
633 __getitem__(DoubleVector self, SWIGPY_SLICEOBJECT * slice) -> DoubleVector
637 slice: SWIGPY_SLICEOBJECT *
639 __getitem__(DoubleVector self, std::vector< double >::difference_type i) -> std::vector< double >::value_type const &
643 i: std::vector< double >::difference_type
646 return libconoptpy4.DoubleVector___getitem__(self, *args)
648 def __setitem__(self, *args):
650 __setitem__(DoubleVector self, SWIGPY_SLICEOBJECT * slice, DoubleVector v)
654 slice: SWIGPY_SLICEOBJECT *
655 v: std::vector< double,std::allocator< double > > const &
657 __setitem__(DoubleVector self, SWIGPY_SLICEOBJECT * slice)
661 slice: SWIGPY_SLICEOBJECT *
663 __setitem__(DoubleVector self, std::vector< double >::difference_type i, std::vector< double >::value_type const & x)
667 i: std::vector< double >::difference_type
668 x: std::vector< double >::value_type const &
671 return libconoptpy4.DoubleVector___setitem__(self, *args)
674 r"""pop(DoubleVector self) -> std::vector< double >::value_type"""
675 return libconoptpy4.DoubleVector_pop(self)
679 append(DoubleVector self, std::vector< double >::value_type const & x)
683 x: std::vector< double >::value_type const &
686 return libconoptpy4.DoubleVector_append(self, x)
689 r"""empty(DoubleVector self) -> bool"""
690 return libconoptpy4.DoubleVector_empty(self)
693 r"""size(DoubleVector self) -> std::vector< double >::size_type"""
694 return libconoptpy4.DoubleVector_size(self)
698 swap(DoubleVector self, DoubleVector v)
702 v: std::vector< double > &
705 return libconoptpy4.DoubleVector_swap(self, v)
708 r"""begin(DoubleVector self) -> std::vector< double >::iterator"""
709 return libconoptpy4.DoubleVector_begin(self)
712 r"""end(DoubleVector self) -> std::vector< double >::iterator"""
713 return libconoptpy4.DoubleVector_end(self)
716 r"""rbegin(DoubleVector self) -> std::vector< double >::reverse_iterator"""
717 return libconoptpy4.DoubleVector_rbegin(self)
720 r"""rend(DoubleVector self) -> std::vector< double >::reverse_iterator"""
721 return libconoptpy4.DoubleVector_rend(self)
724 r"""clear(DoubleVector self)"""
725 return libconoptpy4.DoubleVector_clear(self)
727 def get_allocator(self):
728 r"""get_allocator(DoubleVector self) -> std::vector< double >::allocator_type"""
729 return libconoptpy4.DoubleVector_get_allocator(self)
732 r"""pop_back(DoubleVector self)"""
733 return libconoptpy4.DoubleVector_pop_back(self)
735 def erase(self, *args):
737 erase(DoubleVector self, std::vector< double >::iterator pos) -> std::vector< double >::iterator
741 pos: std::vector< double >::iterator
743 erase(DoubleVector self, std::vector< double >::iterator first, std::vector< double >::iterator last) -> std::vector< double >::iterator
747 first: std::vector< double >::iterator
748 last: std::vector< double >::iterator
751 return libconoptpy4.DoubleVector_erase(self, *args)
753 def __init__(self, *args):
755 __init__(DoubleVector self) -> DoubleVector
756 __init__(DoubleVector self, DoubleVector other) -> DoubleVector
760 other: std::vector< double > const &
762 __init__(DoubleVector self, std::vector< double >::size_type size) -> DoubleVector
766 size: std::vector< double >::size_type
768 __init__(DoubleVector self, std::vector< double >::size_type size, std::vector< double >::value_type const & value) -> DoubleVector
772 size: std::vector< double >::size_type
773 value: std::vector< double >::value_type const &
776 libconoptpy4.DoubleVector_swiginit(self, libconoptpy4.new_DoubleVector(*args))
778 def push_back(self, x):
780 push_back(DoubleVector self, std::vector< double >::value_type const & x)
784 x: std::vector< double >::value_type const &
787 return libconoptpy4.DoubleVector_push_back(self, x)
790 r"""front(DoubleVector self) -> std::vector< double >::value_type const &"""
791 return libconoptpy4.DoubleVector_front(self)
794 r"""back(DoubleVector self) -> std::vector< double >::value_type const &"""
795 return libconoptpy4.DoubleVector_back(self)
797 def assign(self, n, x):
799 assign(DoubleVector self, std::vector< double >::size_type n, std::vector< double >::value_type const & x)
803 n: std::vector< double >::size_type
804 x: std::vector< double >::value_type const &
807 return libconoptpy4.DoubleVector_assign(self, n, x)
809 def resize(self, *args):
811 resize(DoubleVector self, std::vector< double >::size_type new_size)
815 new_size: std::vector< double >::size_type
817 resize(DoubleVector self, std::vector< double >::size_type new_size, std::vector< double >::value_type const & x)
821 new_size: std::vector< double >::size_type
822 x: std::vector< double >::value_type const &
825 return libconoptpy4.DoubleVector_resize(self, *args)
827 def insert(self, *args):
829 insert(DoubleVector self, std::vector< double >::iterator pos, std::vector< double >::value_type const & x) -> std::vector< double >::iterator
833 pos: std::vector< double >::iterator
834 x: std::vector< double >::value_type const &
836 insert(DoubleVector self, std::vector< double >::iterator pos, std::vector< double >::size_type n, std::vector< double >::value_type const & x)
840 pos: std::vector< double >::iterator
841 n: std::vector< double >::size_type
842 x: std::vector< double >::value_type const &
845 return libconoptpy4.DoubleVector_insert(self, *args)
847 def reserve(self, n):
849 reserve(DoubleVector self, std::vector< double >::size_type n)
853 n: std::vector< double >::size_type
856 return libconoptpy4.DoubleVector_reserve(self, n)
859 r"""capacity(DoubleVector self) -> std::vector< double >::size_type"""
860 return libconoptpy4.DoubleVector_capacity(self)
861 __swig_destroy__ = libconoptpy4.delete_DoubleVector
863# Register DoubleVector in libconoptpy4:
864libconoptpy4.DoubleVector_swigregister(DoubleVector)
865class StringVector(object):
866 r"""Proxy of C++ std::vector< std::string > class."""
868 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
869 __repr__ = _swig_repr
872 r"""iterator(StringVector self) -> SwigPyIterator"""
873 return libconoptpy4.StringVector_iterator(self)
875 return self.iterator()
877 def __nonzero__(self):
878 r"""__nonzero__(StringVector self) -> bool"""
879 return libconoptpy4.StringVector___nonzero__(self)
882 r"""__bool__(StringVector self) -> bool"""
883 return libconoptpy4.StringVector___bool__(self)
886 r"""__len__(StringVector self) -> std::vector< std::string >::size_type"""
887 return libconoptpy4.StringVector___len__(self)
889 def __getslice__(self, i, j):
891 __getslice__(StringVector self, std::vector< std::string >::difference_type i, std::vector< std::string >::difference_type j) -> StringVector
895 i: std::vector< std::string >::difference_type
896 j: std::vector< std::string >::difference_type
899 return libconoptpy4.StringVector___getslice__(self, i, j)
901 def __setslice__(self, *args):
903 __setslice__(StringVector self, std::vector< std::string >::difference_type i, std::vector< std::string >::difference_type j)
907 i: std::vector< std::string >::difference_type
908 j: std::vector< std::string >::difference_type
910 __setslice__(StringVector self, std::vector< std::string >::difference_type i, std::vector< std::string >::difference_type j, StringVector v)
914 i: std::vector< std::string >::difference_type
915 j: std::vector< std::string >::difference_type
916 v: std::vector< std::string,std::allocator< std::string > > const &
919 return libconoptpy4.StringVector___setslice__(self, *args)
921 def __delslice__(self, i, j):
923 __delslice__(StringVector self, std::vector< std::string >::difference_type i, std::vector< std::string >::difference_type j)
927 i: std::vector< std::string >::difference_type
928 j: std::vector< std::string >::difference_type
931 return libconoptpy4.StringVector___delslice__(self, i, j)
933 def __delitem__(self, *args):
935 __delitem__(StringVector self, std::vector< std::string >::difference_type i)
939 i: std::vector< std::string >::difference_type
941 __delitem__(StringVector self, SWIGPY_SLICEOBJECT * slice)
945 slice: SWIGPY_SLICEOBJECT *
948 return libconoptpy4.StringVector___delitem__(self, *args)
950 def __getitem__(self, *args):
952 __getitem__(StringVector self, SWIGPY_SLICEOBJECT * slice) -> StringVector
956 slice: SWIGPY_SLICEOBJECT *
958 __getitem__(StringVector self, std::vector< std::string >::difference_type i) -> std::vector< std::string >::value_type const &
962 i: std::vector< std::string >::difference_type
965 return libconoptpy4.StringVector___getitem__(self, *args)
967 def __setitem__(self, *args):
969 __setitem__(StringVector self, SWIGPY_SLICEOBJECT * slice, StringVector v)
973 slice: SWIGPY_SLICEOBJECT *
974 v: std::vector< std::string,std::allocator< std::string > > const &
976 __setitem__(StringVector self, SWIGPY_SLICEOBJECT * slice)
980 slice: SWIGPY_SLICEOBJECT *
982 __setitem__(StringVector self, std::vector< std::string >::difference_type i, std::vector< std::string >::value_type const & x)
986 i: std::vector< std::string >::difference_type
987 x: std::vector< std::string >::value_type const &
990 return libconoptpy4.StringVector___setitem__(self, *args)
993 r"""pop(StringVector self) -> std::vector< std::string >::value_type"""
994 return libconoptpy4.StringVector_pop(self)
998 append(StringVector self, std::vector< std::string >::value_type const & x)
1002 x: std::vector< std::string >::value_type const &
1005 return libconoptpy4.StringVector_append(self, x)
1008 r"""empty(StringVector self) -> bool"""
1009 return libconoptpy4.StringVector_empty(self)
1012 r"""size(StringVector self) -> std::vector< std::string >::size_type"""
1013 return libconoptpy4.StringVector_size(self)
1017 swap(StringVector self, StringVector v)
1021 v: std::vector< std::string > &
1024 return libconoptpy4.StringVector_swap(self, v)
1027 r"""begin(StringVector self) -> std::vector< std::string >::iterator"""
1028 return libconoptpy4.StringVector_begin(self)
1031 r"""end(StringVector self) -> std::vector< std::string >::iterator"""
1032 return libconoptpy4.StringVector_end(self)
1035 r"""rbegin(StringVector self) -> std::vector< std::string >::reverse_iterator"""
1036 return libconoptpy4.StringVector_rbegin(self)
1039 r"""rend(StringVector self) -> std::vector< std::string >::reverse_iterator"""
1040 return libconoptpy4.StringVector_rend(self)
1043 r"""clear(StringVector self)"""
1044 return libconoptpy4.StringVector_clear(self)
1046 def get_allocator(self):
1047 r"""get_allocator(StringVector self) -> std::vector< std::string >::allocator_type"""
1048 return libconoptpy4.StringVector_get_allocator(self)
1051 r"""pop_back(StringVector self)"""
1052 return libconoptpy4.StringVector_pop_back(self)
1054 def erase(self, *args):
1056 erase(StringVector self, std::vector< std::string >::iterator pos) -> std::vector< std::string >::iterator
1060 pos: std::vector< std::string >::iterator
1062 erase(StringVector self, std::vector< std::string >::iterator first, std::vector< std::string >::iterator last) -> std::vector< std::string >::iterator
1066 first: std::vector< std::string >::iterator
1067 last: std::vector< std::string >::iterator
1070 return libconoptpy4.StringVector_erase(self, *args)
1072 def __init__(self, *args):
1074 __init__(StringVector self) -> StringVector
1075 __init__(StringVector self, StringVector other) -> StringVector
1079 other: std::vector< std::string > const &
1081 __init__(StringVector self, std::vector< std::string >::size_type size) -> StringVector
1085 size: std::vector< std::string >::size_type
1087 __init__(StringVector self, std::vector< std::string >::size_type size, std::vector< std::string >::value_type const & value) -> StringVector
1091 size: std::vector< std::string >::size_type
1092 value: std::vector< std::string >::value_type const &
1095 libconoptpy4.StringVector_swiginit(self, libconoptpy4.new_StringVector(*args))
1097 def push_back(self, x):
1099 push_back(StringVector self, std::vector< std::string >::value_type const & x)
1103 x: std::vector< std::string >::value_type const &
1106 return libconoptpy4.StringVector_push_back(self, x)
1109 r"""front(StringVector self) -> std::vector< std::string >::value_type const &"""
1110 return libconoptpy4.StringVector_front(self)
1113 r"""back(StringVector self) -> std::vector< std::string >::value_type const &"""
1114 return libconoptpy4.StringVector_back(self)
1116 def assign(self, n, x):
1118 assign(StringVector self, std::vector< std::string >::size_type n, std::vector< std::string >::value_type const & x)
1122 n: std::vector< std::string >::size_type
1123 x: std::vector< std::string >::value_type const &
1126 return libconoptpy4.StringVector_assign(self, n, x)
1128 def resize(self, *args):
1130 resize(StringVector self, std::vector< std::string >::size_type new_size)
1134 new_size: std::vector< std::string >::size_type
1136 resize(StringVector self, std::vector< std::string >::size_type new_size, std::vector< std::string >::value_type const & x)
1140 new_size: std::vector< std::string >::size_type
1141 x: std::vector< std::string >::value_type const &
1144 return libconoptpy4.StringVector_resize(self, *args)
1146 def insert(self, *args):
1148 insert(StringVector self, std::vector< std::string >::iterator pos, std::vector< std::string >::value_type const & x) -> std::vector< std::string >::iterator
1152 pos: std::vector< std::string >::iterator
1153 x: std::vector< std::string >::value_type const &
1155 insert(StringVector self, std::vector< std::string >::iterator pos, std::vector< std::string >::size_type n, std::vector< std::string >::value_type const & x)
1159 pos: std::vector< std::string >::iterator
1160 n: std::vector< std::string >::size_type
1161 x: std::vector< std::string >::value_type const &
1164 return libconoptpy4.StringVector_insert(self, *args)
1166 def reserve(self, n):
1168 reserve(StringVector self, std::vector< std::string >::size_type n)
1172 n: std::vector< std::string >::size_type
1175 return libconoptpy4.StringVector_reserve(self, n)
1178 r"""capacity(StringVector self) -> std::vector< std::string >::size_type"""
1179 return libconoptpy4.StringVector_capacity(self)
1180 __swig_destroy__ = libconoptpy4.delete_StringVector
1182# Register StringVector in libconoptpy4:
1183libconoptpy4.StringVector_swigregister(StringVector)
1184class IntArray3(object):
1185 r"""Proxy of C++ std::array< int,3 > class."""
1187 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
1188 __repr__ = _swig_repr
1191 r"""iterator(IntArray3 self) -> SwigPyIterator"""
1192 return libconoptpy4.IntArray3_iterator(self)
1194 return self.iterator()
1196 def __nonzero__(self):
1197 r"""__nonzero__(IntArray3 self) -> bool"""
1198 return libconoptpy4.IntArray3___nonzero__(self)
1201 r"""__bool__(IntArray3 self) -> bool"""
1202 return libconoptpy4.IntArray3___bool__(self)
1205 r"""__len__(IntArray3 self) -> std::array< int,3 >::size_type"""
1206 return libconoptpy4.IntArray3___len__(self)
1208 def __getslice__(self, i, j):
1210 __getslice__(IntArray3 self, std::array< int,3 >::difference_type i, std::array< int,3 >::difference_type j) -> IntArray3
1214 i: std::array< int,3 >::difference_type
1215 j: std::array< int,3 >::difference_type
1218 return libconoptpy4.IntArray3___getslice__(self, i, j)
1220 def __setslice__(self, *args):
1222 __setslice__(IntArray3 self, std::array< int,3 >::difference_type i, std::array< int,3 >::difference_type j)
1226 i: std::array< int,3 >::difference_type
1227 j: std::array< int,3 >::difference_type
1229 __setslice__(IntArray3 self, std::array< int,3 >::difference_type i, std::array< int,3 >::difference_type j, IntArray3 v)
1233 i: std::array< int,3 >::difference_type
1234 j: std::array< int,3 >::difference_type
1235 v: std::array< int,3 > const &
1238 return libconoptpy4.IntArray3___setslice__(self, *args)
1240 def __delslice__(self, i, j):
1242 __delslice__(IntArray3 self, std::array< int,3 >::difference_type i, std::array< int,3 >::difference_type j)
1246 i: std::array< int,3 >::difference_type
1247 j: std::array< int,3 >::difference_type
1250 return libconoptpy4.IntArray3___delslice__(self, i, j)
1252 def __delitem__(self, *args):
1254 __delitem__(IntArray3 self, std::array< int,3 >::difference_type i)
1258 i: std::array< int,3 >::difference_type
1260 __delitem__(IntArray3 self, SWIGPY_SLICEOBJECT * slice)
1264 slice: SWIGPY_SLICEOBJECT *
1267 return libconoptpy4.IntArray3___delitem__(self, *args)
1269 def __getitem__(self, *args):
1271 __getitem__(IntArray3 self, SWIGPY_SLICEOBJECT * slice) -> IntArray3
1275 slice: SWIGPY_SLICEOBJECT *
1277 __getitem__(IntArray3 self, std::array< int,3 >::difference_type i) -> std::array< int,3 >::value_type const &
1281 i: std::array< int,3 >::difference_type
1284 return libconoptpy4.IntArray3___getitem__(self, *args)
1286 def __setitem__(self, *args):
1288 __setitem__(IntArray3 self, SWIGPY_SLICEOBJECT * slice, IntArray3 v)
1292 slice: SWIGPY_SLICEOBJECT *
1293 v: std::array< int,3 > const &
1295 __setitem__(IntArray3 self, SWIGPY_SLICEOBJECT * slice)
1299 slice: SWIGPY_SLICEOBJECT *
1301 __setitem__(IntArray3 self, std::array< int,3 >::difference_type i, std::array< int,3 >::value_type const & x)
1305 i: std::array< int,3 >::difference_type
1306 x: std::array< int,3 >::value_type const &
1309 return libconoptpy4.IntArray3___setitem__(self, *args)
1311 def __init__(self, *args):
1313 __init__(IntArray3 self) -> IntArray3
1314 __init__(IntArray3 self, IntArray3 other) -> IntArray3
1318 other: std::array< int,3 > const &
1321 libconoptpy4.IntArray3_swiginit(self, libconoptpy4.new_IntArray3(*args))
1324 r"""empty(IntArray3 self) -> bool"""
1325 return libconoptpy4.IntArray3_empty(self)
1328 r"""size(IntArray3 self) -> std::array< int,3 >::size_type"""
1329 return libconoptpy4.IntArray3_size(self)
1333 swap(IntArray3 self, IntArray3 v)
1337 v: std::array< int,3 > &
1340 return libconoptpy4.IntArray3_swap(self, v)
1343 r"""begin(IntArray3 self) -> std::array< int,3 >::iterator"""
1344 return libconoptpy4.IntArray3_begin(self)
1347 r"""end(IntArray3 self) -> std::array< int,3 >::iterator"""
1348 return libconoptpy4.IntArray3_end(self)
1351 r"""rbegin(IntArray3 self) -> std::array< int,3 >::reverse_iterator"""
1352 return libconoptpy4.IntArray3_rbegin(self)
1355 r"""rend(IntArray3 self) -> std::array< int,3 >::reverse_iterator"""
1356 return libconoptpy4.IntArray3_rend(self)
1359 r"""front(IntArray3 self) -> std::array< int,3 >::value_type const &"""
1360 return libconoptpy4.IntArray3_front(self)
1363 r"""back(IntArray3 self) -> std::array< int,3 >::value_type const &"""
1364 return libconoptpy4.IntArray3_back(self)
1368 fill(IntArray3 self, std::array< int,3 >::value_type const & u)
1372 u: std::array< int,3 >::value_type const &
1375 return libconoptpy4.IntArray3_fill(self, u)
1376 __swig_destroy__ = libconoptpy4.delete_IntArray3
1378# Register IntArray3 in libconoptpy4:
1379libconoptpy4.IntArray3_swigregister(IntArray3)
1380class Conopt(object):
1384 @ingroup CONOPT_PYTHON
1387 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
1388 __repr__ = _swig_repr
1389 Infinity = libconoptpy4.Conopt_Infinity
1390 r""" CONOPT value for infinity"""
1392 def __init__(self, *args):
1396 @param modelName: the name for the model.
1399 libconoptpy4.Conopt_swiginit(self, libconoptpy4.new_Conopt(*args))
1400 __swig_destroy__ = libconoptpy4.delete_Conopt
1404 @copydoc DEF_COI_SOLVE
1407 @ingroup UTILITY_ROUTINES_PYTHON
1409 return libconoptpy4.Conopt_solve(self)
1411 def checkModelAndParameters(self):
1412 r""" checks the model data and parameters to ensure it is setup correctly"""
1413 return libconoptpy4.Conopt_checkModelAndParameters(self)
1415 def controlVector(self):
1417 returns the control vector pointer.
1419 This is for use in the C-interface methods
1422 @ingroup UTILITY_ROUTINES_PYTHON
1424 return libconoptpy4.Conopt_controlVector(self)
1426 def printStatus(self):
1428 prints the status of the optimisation
1431 @ingroup UTILITY_ROUTINES_PYTHON
1433 return libconoptpy4.Conopt_printStatus(self)
1437 returns the model name
1440 @ingroup UTILITY_ROUTINES_PYTHON
1442 return libconoptpy4.Conopt_getName(self)
1444 def loadModel(self, modeldata):
1446 loads the model and stores the pointer in the interface
1448 The user creates an instantiation of the ConoptModelData that includes all details of the model, including
1449 function evaluation callbacks. This method loads the model data into Conopt before solving the problem.
1451 @param modeldata: a user defined ConoptModelData object
1454 @ingroup CONOPTPYTHON_MODELDATA
1456 return libconoptpy4.Conopt_loadModel(self, modeldata)
1458 def modelStatus(self):
1460 returns the model status
1463 return libconoptpy4.Conopt_modelStatus(self)
1465 def solutionStatus(self):
1467 return the solution status
1470 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1472 return libconoptpy4.Conopt_solutionStatus(self)
1474 def iterations(self):
1476 returns the number of iterations
1479 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1481 return libconoptpy4.Conopt_iterations(self)
1483 def objectiveValue(self):
1485 returns the objective value
1488 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1490 return libconoptpy4.Conopt_objectiveValue(self)
1492 def getVariableValues(self):
1494 returns the variable values
1497 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1499 return libconoptpy4.Conopt_getVariableValues(self)
1501 def getVariableMarginals(self):
1503 returns the variable marginals
1506 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1508 return libconoptpy4.Conopt_getVariableMarginals(self)
1510 def getVariableBasisStatus(self):
1512 returns the variable basis status
1515 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1517 return libconoptpy4.Conopt_getVariableBasisStatus(self)
1519 def getVariableStatus(self):
1521 returns the variable status
1524 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1526 return libconoptpy4.Conopt_getVariableStatus(self)
1528 def getConstraintValues(self):
1530 returns the constraint values
1533 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1535 return libconoptpy4.Conopt_getConstraintValues(self)
1537 def getConstraintMarginals(self):
1539 returns the constraint marginals
1542 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1544 return libconoptpy4.Conopt_getConstraintMarginals(self)
1546 def getConstraintBasisStatus(self):
1548 returns the constraint basis status
1551 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1553 return libconoptpy4.Conopt_getConstraintBasisStatus(self)
1555 def getConstraintStatus(self):
1557 returns the constraint status
1560 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1562 return libconoptpy4.Conopt_getConstraintStatus(self)
1564 def setMessageHandler(self, msghandler):
1566 sets the message handler to the user supplied handler.
1568 The pointer to the supplied message handler is stored in the interface object. The user is responsible for the
1569 creation and destruction of the message handler object.
1571 @param msghandler: a user defined ConoptMessageHandler object
1574 @ingroup CONOPTPYTHON_MESSAGEHANDLER
1576 return libconoptpy4.Conopt_setMessageHandler(self, msghandler)
1578 def sendMessage(self, msg):
1580 sends a message to the message handler
1582 @param msg: A string for the message that will be processed in the message handler
1585 @ingroup CONOPTPYTHON_MESSAGEHANDLER
1587 return libconoptpy4.Conopt_sendMessage(self, msg)
1589 def setVerbosityLevel(self, verblevel):
1591 sets the verbosity level for messaging
1593 The verbosity level is:
1594 - None -- turn off all output
1595 - Normal -- normal output, iteration log to stdout and error to stderr
1596 - Error -- more detailed iteration log to stdout, error to stdout and stderr
1597 - Debug -- extensive iteration log, error to stdout and stderr
1599 @param verblevel: the verbosity level for the message handler
1602 @ingroup CONOPTPYTHON_MESSAGEHANDLER
1604 return libconoptpy4.Conopt_setVerbosityLevel(self, verblevel)
1609 returns the version number.
1611 It can be used to ensure that the modeler is linked to the correct version of the CONOPT DLL.
1614 @ingroup UTILITY_ROUTINES_PYTHON
1616 return libconoptpy4.Conopt_version()
1618 def debugFV(self, debugfv):
1620 @copydoc DEF_COI_DEBUGFV
1623 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1625 return libconoptpy4.Conopt_debugFV(self, debugfv)
1627 def squareModel(self, square):
1629 @copydoc DEF_COI_SQUARE
1632 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1634 return libconoptpy4.Conopt_squareModel(self, square)
1636 def setLicense(self, licint1, licint2, licint3, licstring):
1638 @copydoc DEF_COI_LICENSE
1641 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1643 return libconoptpy4.Conopt_setLicense(self, licint1, licint2, licint3, licstring)
1645 def setItLim(self, itlim):
1647 @copydoc DEF_COI_ITLIM
1650 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1652 return libconoptpy4.Conopt_setItLim(self, itlim)
1654 def setErrLim(self, errlim):
1656 @copydoc DEF_COI_ERRLIM
1659 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1661 return libconoptpy4.Conopt_setErrLim(self, errlim)
1663 def fVincLin(self, fvinclin):
1665 @copydoc DEF_COI_FVINCLIN
1668 @ingroup REGISTRATION_OF_SIZES_PYTHON
1670 return libconoptpy4.Conopt_fVincLin(self, fvinclin)
1672 def fVforAll(self, fvforall):
1674 @copydoc DEF_COI_FVFORALL
1677 @ingroup REGISTRATION_OF_SIZES_PYTHON
1679 return libconoptpy4.Conopt_fVforAll(self, fvforall)
1681 def setMaxSup(self, maxsup):
1683 @copydoc DEF_COI_MAXSUP
1686 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1688 return libconoptpy4.Conopt_setMaxSup(self, maxsup)
1690 def allowEmptyRow(self, emptyrow):
1692 @copydoc DEF_COI_EMPTYROW
1695 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1697 return libconoptpy4.Conopt_allowEmptyRow(self, emptyrow)
1699 def allowEmptyCol(self, emptycol):
1701 @copydoc DEF_COI_EMPTYCOL
1704 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1706 return libconoptpy4.Conopt_allowEmptyCol(self, emptycol)
1708 def debug2D(self, debug2d):
1710 @copydoc DEF_COI_DEBUG2D
1713 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1715 return libconoptpy4.Conopt_debug2D(self, debug2d)
1717 def disCont(self, discont):
1719 @copydoc DEF_COI_DISCONT
1722 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1724 return libconoptpy4.Conopt_disCont(self, discont)
1726 def clearM(self, clearm):
1728 @copydoc DEF_COI_CLEARM
1731 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1733 return libconoptpy4.Conopt_clearM(self, clearm)
1735 def setResLim(self, reslim):
1737 @copydoc DEF_COI_RESLIM
1740 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1742 return libconoptpy4.Conopt_setResLim(self, reslim)
1744 def setMaxHeap(self, maxheap):
1746 @copydoc DEF_COI_MAXHEAP
1749 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1751 return libconoptpy4.Conopt_setMaxHeap(self, maxheap)
1753 def setThreadS(self, threads):
1755 @copydoc DEF_COI_THREADS
1758 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1760 return libconoptpy4.Conopt_setThreadS(self, threads)
1762 def setThreadF(self, threadf):
1764 @copydoc DEF_COI_THREADF
1767 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1769 return libconoptpy4.Conopt_setThreadF(self, threadf)
1771 def setThread2D(self, thread2d):
1773 @copydoc DEF_COI_THREAD2D
1776 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1778 return libconoptpy4.Conopt_setThread2D(self, thread2d)
1780 def setThreadC(self, threadc):
1782 @copydoc DEF_COI_THREADC
1785 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1787 return libconoptpy4.Conopt_setThreadC(self, threadc)
1789 def getMaxThreads(self):
1791 returns the maximum number of threads that can be used by CONOPT.
1793 If you are using multiple threads it may be necessary to know in advance how many threads CONOPT can use. If
1794 called inside a parallel loop, this method will return one---indicating that CONOPT cannot use multiple
1795 threads when CONOPT itself is called in parallel. Therefore, this method should be called in some sequential
1796 initialization code and not inside a function evaluation routine, that could be called in parallel.
1799 @ingroup UTILITY_ROUTINES_PYTHON
1801 return libconoptpy4.Conopt_getMaxThreads(self)
1803 def getMaxHeapUsed(self):
1805 After a model has been solved this method will return the amount of heap memory used.
1808 @ingroup UTILITY_ROUTINES_PYTHON
1810 return libconoptpy4.Conopt_getMaxHeapUsed(self)
1812 def getRangeErrors(self):
1814 returns the range errors that were encountered.
1817 @ingroup UTILITY_ROUTINES_PYTHON
1819 return libconoptpy4.Conopt_getRangeErrors(self)
1821# Register Conopt in libconoptpy4:
1822libconoptpy4.Conopt_swigregister(Conopt)
1823ConstraintType_Eq = libconoptpy4.ConstraintType_Eq
1824r""" equality constraint"""
1825ConstraintType_GtEq = libconoptpy4.ConstraintType_GtEq
1826r""" greater than or equal to constraint"""
1827ConstraintType_LtEq = libconoptpy4.ConstraintType_LtEq
1828r""" lesser than or equal to constraint"""
1829ConstraintType_Free = libconoptpy4.ConstraintType_Free
1830r""" an unrestricted constraint. This is used when specifying the objective function."""
1831ObjectiveElement_Variable = libconoptpy4.ObjectiveElement_Variable
1832r""" the objective is given by a single variable"""
1833ObjectiveElement_Constraint = libconoptpy4.ObjectiveElement_Constraint
1834r""" the objective is given by the value of an equation"""
1835Sense_Minimize = libconoptpy4.Sense_Minimize
1836r""" a minimisation problem (default)"""
1837Sense_Maximize = libconoptpy4.Sense_Maximize
1838r""" a maximisation problem"""
1839SDEvaluationType__None = libconoptpy4.SDEvaluationType__None
1841SDEvaluationType_Constraint = libconoptpy4.SDEvaluationType_Constraint
1843SDEvaluationType_Lagrangian = libconoptpy4.SDEvaluationType_Lagrangian
1845class Variable(object):
1849 This struct is used internally for supplying the variable data to CONOPT. The user is able to query this data from
1850 the ConoptModelData object. However, the user is not able to change the data after the variable has been added to
1854 @ingroup QUERY_MODEL_PYTHON
1857 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
1858 __repr__ = _swig_repr
1860 def __init__(self, idx, low, up, cur=0, varstat=-1):
1862 __init__(Variable self, int idx, double low, double up, double cur=0, int varstat=-1) -> Variable
1873 libconoptpy4.Variable_swiginit(self, libconoptpy4.new_Variable(idx, low, up, cur, varstat))
1875 def addNonzero(self, conindex, value, nlflag):
1877 adds a non-zero to the variable data
1879 Notes: this is used internally.
1881 return libconoptpy4.Variable_addNonzero(self, conindex, value, nlflag)
1883 def sortNonzeros(self):
1885 sorts the non-zeros by constraint index.
1887 Notes: this is used internally.
1889 return libconoptpy4.Variable_sortNonzeros(self)
1890 index = property(libconoptpy4.Variable_index_get, libconoptpy4.Variable_index_set, doc=
r""" the index of the variable in the problem""")
1891 lower = property(libconoptpy4.Variable_lower_get, libconoptpy4.Variable_lower_set, doc=
r""" the lower bound of the variable""")
1892 upper = property(libconoptpy4.Variable_upper_get, libconoptpy4.Variable_upper_set, doc=
r""" the upper bound of the variable""")
1893 curr = property(libconoptpy4.Variable_curr_get, libconoptpy4.Variable_curr_set, doc=
r""" the initial value of the variable. This is 0 by default.""")
1894 varstatus = property(libconoptpy4.Variable_varstatus_get, libconoptpy4.Variable_varstatus_set, doc=
r""" the initial status of the variable. This depends on the COIDEF_IniStat setting.""")
1895 consindex_ = property(libconoptpy4.Variable_consindex__get, libconoptpy4.Variable_consindex__set, doc=
r""" the index of the constraints""")
1896 value_ = property(libconoptpy4.Variable_value__get, libconoptpy4.Variable_value__set, doc=
r""" the non-zero for linear terms, for non-linear terms this is ignored""")
1897 nlflag_ = property(libconoptpy4.Variable_nlflag__get, libconoptpy4.Variable_nlflag__set, doc=
r""" indicator whether the non-zero is part of a non-linear term""")
1898 sortorder_ = property(libconoptpy4.Variable_sortorder__get, libconoptpy4.Variable_sortorder__set, doc=
r""" a vector to support the sorting of the non-zeros""")
1899 __swig_destroy__ = libconoptpy4.delete_Variable
1901# Register Variable in libconoptpy4:
1902libconoptpy4.Variable_swigregister(Variable)
1903class Constraint(object):
1907 This struct is used internally for supplying the variable data to CONOPT. The user is able to query this data from
1908 the ConoptModelData object. However, the user is not able to change the data after the variable has been added to
1912 @ingroup QUERY_MODEL_PYTHON
1915 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
1916 __repr__ = _swig_repr
1918 def __init__(self, idx, type, bound, slackstat):
1920 __init__(Constraint self, int idx, ConoptConstraintType type, double bound, int slackstat) -> Constraint
1925 type: enum ConoptConstraintType
1930 libconoptpy4.Constraint_swiginit(self, libconoptpy4.new_Constraint(idx, type, bound, slackstat))
1931 index = property(libconoptpy4.Constraint_index_get, libconoptpy4.Constraint_index_set, doc=
r""" the index of the constraint in the problem""")
1932 constype = property(libconoptpy4.Constraint_constype_get, libconoptpy4.Constraint_constype_set, doc=
r""" 0: equality, 1: greater than or equal, 2: less than or equal, 3: free row""")
1933 rhs = property(libconoptpy4.Constraint_rhs_get, libconoptpy4.Constraint_rhs_set, doc=
r""" the right hand side of the constraint""")
1934 slackstatus = property(libconoptpy4.Constraint_slackstatus_get, libconoptpy4.Constraint_slackstatus_set, doc=
r""" the initial status of the slacks. This depends on the COIDEF_IniStat setting.""")
1935 __swig_destroy__ = libconoptpy4.delete_Constraint
1937# Register Constraint in libconoptpy4:
1938libconoptpy4.Constraint_swigregister(Constraint)
1939class ConoptModelData(object):
1940 r""" The Model Data class"""
1942 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
1943 __repr__ = _swig_repr
1947 if self.__class__ == ConoptModelData:
1951 libconoptpy4.ConoptModelData_swiginit(self, libconoptpy4.new_ConoptModelData(_self, ))
1952 __swig_destroy__ = libconoptpy4.delete_ConoptModelData
1954 def readMatrix(self, lower, curr, upper, vsta, type, rhs, esta, colsta, rowno, value, nlflag, numvar, numcon, numnz):
1956 loads the structure of the model into CONOPT.
1958 Using the C++ interface, there are two ways to load the model into CONOPT.
1959 The first method follows the process used for the Fortran and C interfaces. This involves:
1960 1. setting the problem dimension by calling setProblemDimension().
1961 2. set the objective element (constraint or variable) by calling setObjectiveElement().
1962 3. set the optimisation sense by calling setOptimizationSense().
1963 4. implementing a readMatrix() method that loads the model using a column-oriented sparse matrix format. For
1964 more details regarding the parameters of the readMatrix() method, please see 'API_DEFINING_THE_MODEL_F90'
1966 The second method makes use of the convenience functions included in the C++ interface. Within the
1967 ConoptModelData the methods addConstraint() and addVariable() are provided. As such, to load the model into
1969 1. write a member function for building the model.
1970 2. in the build model function, call addVariable() for each variable to be added to the problem.
1971 3. in the build model function, call addConstraint() for each constraint to be added to the problem. When adding
1972 a constraint, you should specify the variables (by index), coefficients and non-linear flags (for all
1974 4. set the objective element (constraint or variable) by calling setObjectiveElement().
1975 5. set the optimisation sense by calling setOptimizationSense().
1976 When the solve method is called, the default readMatrix() method will be called, which will load the model into
1977 CONOPT as specified by the calls to addVariable() and addConstraint().
1981 return libconoptpy4.ConoptModelData_readMatrix(self, lower, curr, upper, vsta, type, rhs, esta, colsta, rowno, value, nlflag, numvar, numcon, numnz)
1983 def setProblemDimension(self, numvar, numcons, numnz, numnlnz):
1985 sets the problem dimension. This is called if the user wants to implement a custom readMatrix() method.
1987 NOTE: it is not possible to call setProblemDimension() and addConstraint() or addVariable(). The latter
1988 functions can only be used if the problem dimension is not set and the default readMatrix() method is used.
1992 @param numvar: the number of variables in the problem
1993 @param numcons: the number of constraints in the problem
1994 @param numnz: the number of non-zeros in the constraint matrix
1995 @param numnlnz: the number of nonlinear non-zeros in the constraint matrix
1997 return libconoptpy4.ConoptModelData_setProblemDimension(self, numvar, numcons, numnz, numnlnz)
1999 def addConstraint(self, *args):
2002 adds a constraint to the problem. The non-zero coefficients are added later
2006 @param constype: the type of constraint, 0: ==, 1: >=, 2: <=, 3: free
2007 @param rhs: the right hand side
2008 @param slackstatus: initial status of the slack variables, see IniStat
2013 adds a constraint to the problem. The matrix non-zeros are added based on the supplied variables
2017 @param constype: the type of constraint, 0: ==, 1: >=, 2: <=, 3: free
2018 @param rhs: the right hand side
2019 @param varindex: the variables this constraint has non-zero coefficients
2020 @param value: the non-zero of the variable
2021 @param nlflag: flag to set whether the variable belongs to a non-linear term
2022 @param slackstatus: initial status of the slack variables, see IniStat
2027 adds a constraint to the problem. The matrix non-zeros are added based on the supplied variables
2031 @param constype: the type of constraint, 0: ==, 1: >=, 2: <=, 3: free
2032 @param rhs: the right hand side
2033 @param varindex: the variables this constraint has non-zero coefficients
2034 @param value: the non-zero of the variable
2035 @param nlflag: flag to set whether the variable belongs to a non-linear term
2036 @param slackstatus: initial status of the slack variables, see IniStat
2038 return libconoptpy4.ConoptModelData_addConstraint(self, *args)
2040 def addVariable(self, *args):
2043 adds a variable to the model. The non-zero coefficients are added later.
2047 @param lower: lower bound for the variable
2048 @param upper: upper bound for the variable
2049 @param curr: initial value of the variable, can be set to 0
2050 @param varstatus: initial status of the variable, see IniStat
2055 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
2059 @param lower: lower bound for the variable
2060 @param upper: upper bound for the variable
2061 @param consindex: the constraints this variable has non-zero coefficients
2062 @param value: the non-zero of the variable
2063 @param nlflag: flag to set whether the variable belongs to a non-linear term
2064 @param curr: initial value of the variable, can be set to 0
2065 @param varstatus: initial status of the variable, see IniStat
2070 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
2074 @param lower: lower bound for the variable
2075 @param upper: upper bound for the variable
2076 @param consindex: the constraints this variable has non-zero coefficients
2077 @param value: the non-zero of the variable
2078 @param nlflag: flag to set whether the variable belongs to a non-linear term
2079 @param curr: initial value of the variable, can be set to 0
2080 @param varstatus: initial status of the variable, see IniStat
2085 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
2089 @param lower: lower bound for the variable
2090 @param upper: upper bound for the variable
2091 @param consindex: the constraints this variable has non-zero coefficients
2092 @param value: the non-zero of the variable
2093 @param nlflag: flag to set whether the variable belongs to a non-linear term
2094 @param curr: initial value of the variable, can be set to 0
2095 @param varstatus: initial status of the variable, see IniStat
2097 return libconoptpy4.ConoptModelData_addVariable(self, *args)
2099 def setObjectiveElement(self, elem, elemindex):
2101 sets the index for the objective variable or constraint
2105 return libconoptpy4.ConoptModelData_setObjectiveElement(self, elem, elemindex)
2107 def setOptimizationSense(self, sense):
2109 sets the optimisation direction.
2113 return libconoptpy4.ConoptModelData_setOptimizationSense(self, sense)
2115 def setInitialStatusOption(self, inistat):
2117 the setting to indicate how the initial status of the variables and slack variables will be handled.
2119 The initial status is set in the addVariable() and addConstraint() methods, or in the readMatrix() method if the
2120 classical model input approach is used. By default, the value of inistat is 0, which means that the variable and
2121 slack status is ignored.
2124 The variable status has the following behaviour:
2125 - 0: The variable is initialized non-basic (if curr = lower or curr = upper) or super-basic, and
2126 - 1: The variable is initialized basic
2127 The slack status has the following behaviour:
2128 - 0: The slack is initialized non-basic (if the constraint is binding in the initial point) or super-basic,
2129 - 1: The slack is initialized basic
2132 The variable status has the following behaviour:
2133 - 0: The variable is initialized at lower bound
2134 - 1: The variable is initialized at upper bound
2135 - 2: The variable is initialized basic, and
2136 - 3: The variable is initialized superbasic.
2137 The slack status has the following behaviour:
2138 - 0: The slack is initialized at lower bound.
2139 - 1: The slack is initialized at upper bound.
2140 - 2: The slack is initialized basic, and
2141 - 3: The slack is initialized superbasic.
2145 return libconoptpy4.ConoptModelData_setInitialStatusOption(self, inistat)
2149 returns the number of variables in the model
2153 return libconoptpy4.ConoptModelData_numVar(self)
2157 returns the number of constraints in the model
2161 return libconoptpy4.ConoptModelData_numCons(self)
2163 def numHessianNonzeros(self):
2165 returns the number of non-zeros in the Hessian
2169 return libconoptpy4.ConoptModelData_numHessianNonzeros(self)
2171 def getVariable(self, *args):
2174 returns a reference to the variable object
2181 returns a reference to the variable object
2185 return libconoptpy4.ConoptModelData_getVariable(self, *args)
2187 def getConstraint(self, *args):
2190 returns a reference to the constraint object
2197 returns a reference to the constraint object
2201 return libconoptpy4.ConoptModelData_getConstraint(self, *args)
2203 def setSDEvaluationType(self, sdevaltype):
2205 informs CONOPT of the method for evaluating the second derivative
2209 return libconoptpy4.ConoptModelData_setSDEvaluationType(self, sdevaltype)
2211 def setSDLagrangianStructure(self, rownum, colnum):
2213 sets the structure of the second derivatives of the Lagrangian
2217 @param rownum: Vector of row numbers of the lower triangular part of the Hessian.
2218 @param colnum: Vector of column numbers of the lower triangular part of the Hessian.
2220 return libconoptpy4.ConoptModelData_setSDLagrangianStructure(self, rownum, colnum)
2222 def getSDLagrangianRowNumbers(self):
2223 r""" returns the row numbers in the second derivative of the lagrangian structure"""
2224 return libconoptpy4.ConoptModelData_getSDLagrangianRowNumbers(self)
2226 def getSDLagrangianColumnNumbers(self):
2227 r""" returns the column numbers in the second derivative of the lagrangian structure"""
2228 return libconoptpy4.ConoptModelData_getSDLagrangianColumnNumbers(self)
2229 def __disown__(self):
2231 libconoptpy4.disown_ConoptModelData(self)
2232 return weakref.proxy(self)
2234# Register ConoptModelData in libconoptpy4:
2235libconoptpy4.ConoptModelData_swigregister(ConoptModelData)
2236VerbosityLevel_VerbLevelMin = libconoptpy4.VerbosityLevel_VerbLevelMin
2238VerbosityLevel__None = libconoptpy4.VerbosityLevel__None
2239r""" turn off all output"""
2240VerbosityLevel_Normal = libconoptpy4.VerbosityLevel_Normal
2241r""" normal output, iteration log to stdout and error to stderr"""
2242VerbosityLevel_Error = libconoptpy4.VerbosityLevel_Error
2243r""" more detailed iteration log to stdout, error to stdout and stderr"""
2244VerbosityLevel_Debug = libconoptpy4.VerbosityLevel_Debug
2245r""" extensive iteration log, error to stdout and stderr"""
2246VerbosityLevel_VerbLevelMax = libconoptpy4.VerbosityLevel_VerbLevelMax
2248class ConoptAlgProgress(object):
2249 r"""Proxy of C++ ConoptAlgProgress class."""
2251 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
2252 __repr__ = _swig_repr
2253 iteration = property(libconoptpy4.ConoptAlgProgress_iteration_get, libconoptpy4.ConoptAlgProgress_iteration_set, doc=
r""" Number of the iteration.""")
2254 phase = property(libconoptpy4.ConoptAlgProgress_phase_get, libconoptpy4.ConoptAlgProgress_phase_set, doc=
r""" The phase of the optimization.""")
2255 numinfeas = property(libconoptpy4.ConoptAlgProgress_numinfeas_get, libconoptpy4.ConoptAlgProgress_numinfeas_set, doc=
r"""
2256 Number of infeasible constraints. In phase 0, this number will only
2257 count the number of "difficult" constraints.
2259 numnopt = property(libconoptpy4.ConoptAlgProgress_numnopt_get, libconoptpy4.ConoptAlgProgress_numnopt_set, doc=
r"""
2260 Number of non-optimal variables. Will be 0 meaning undefined
2263 numsuper = property(libconoptpy4.ConoptAlgProgress_numsuper_get, libconoptpy4.ConoptAlgProgress_numsuper_set, doc=
r""" Number of super-basic variables. Will be zero during phase 0 .""")
2264 suminfeas = property(libconoptpy4.ConoptAlgProgress_suminfeas_get, libconoptpy4.ConoptAlgProgress_suminfeas_set, doc=
r"""
2265 Sum of the infeasibilities. In phase 0 it will include the
2266 infeasibilities in both easy and difficult constraint. During phase
2267 3 and 4 SUMINF will be 0.
2269 objvalue = property(libconoptpy4.ConoptAlgProgress_objvalue_get, libconoptpy4.ConoptAlgProgress_objvalue_set, doc=
r"""
2270 The value of the true objective function. OBJVAL is zero meaning
2271 undefined during phase 0, 1 and 2
2273 rgmax = property(libconoptpy4.ConoptAlgProgress_rgmax_get, libconoptpy4.ConoptAlgProgress_rgmax_set, doc=
r"""
2274 The numerically largest reduced gradient. RGMAX will be zero during
2277 step = property(libconoptpy4.ConoptAlgProgress_step_get, libconoptpy4.ConoptAlgProgress_step_set, doc=
r""" The optimal steplength.""")
2278 numvar = property(libconoptpy4.ConoptAlgProgress_numvar_get, libconoptpy4.ConoptAlgProgress_numvar_set, doc=
r""" The number of variables""")
2281 r"""__init__(ConoptAlgProgress self) -> ConoptAlgProgress"""
2282 libconoptpy4.ConoptAlgProgress_swiginit(self, libconoptpy4.new_ConoptAlgProgress())
2283 __swig_destroy__ = libconoptpy4.delete_ConoptAlgProgress
2285# Register ConoptAlgProgress in libconoptpy4:
2286libconoptpy4.ConoptAlgProgress_swigregister(ConoptAlgProgress)
2287class MessageHandler(object):
2289 The message handler class
2291 @ingroup MESSAGEHANDLER_PYTHON
2294 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
2295 __repr__ = _swig_repr
2299 if self.__class__ == MessageHandler:
2303 libconoptpy4.MessageHandler_swiginit(self, libconoptpy4.new_MessageHandler(_self, ))
2304 __swig_destroy__ = libconoptpy4.delete_MessageHandler
2306 def message(self, smsg, dmsg, nmsg, msgv):
2308 virtual method for handling the messages.
2310 This can be redefined by the user for alternative message handling
2312 @include{doc} message_cb_intro.dox
2315 @ingroup MESSAGEHANDLER_PYTHON
2317 @param smsg: The number of lines in the message that should go to the Screen file. Between 0 and 30.
2318 @param dmsg: The number of lines in the message that should go to the Status file. Between 0 and 30.
2319 @param nmsg: The number of lines in the message that should go to the Documentation file. Between 0 and 30.
2320 @param msgv: Vector with the actual message lines.
2322 return libconoptpy4.MessageHandler_message(self, smsg, dmsg, nmsg, msgv)
2324 def errorMessage(self, rowno, colno, posno, msg):
2326 virtual method for handling error messages.
2328 This can be redefined by the user for alternative message handling
2330 Messages about particular parts of a model are all one line long. The messages
2331 can be related to an error or it can be a general informative message related to
2332 a row or column or Jacobian element. The modeler is responsible for combining
2333 the row and column identification and the message text and for displaying the
2336 There are some special cases for the three first arguments and the message
2337 should be interpreted accordingly. The special cases are:
2339 - **COLNO = -1:** The message is about a row and `ROWNO` will be between 0
2342 - **ROWNO = -1:** The message is about a column and `COLNO` will be between 0
2345 - **ROWNO and COLNO both non-negative:** The message is about a position in
2346 the Jacobian if `POSNO` is non-negative and about a (row,column)-pair if `POSNO`
2349 Examples of message texts are "Inconsistent lower and upper bounds." and "The
2350 variable has reached 'infinity.'" for a column, "The slack has reached
2351 'infinity.'" for a row and "Initial Jacobian element was not defined." for a
2355 @ingroup MESSAGEHANDLER_PYTHON
2357 @param rowno: The number of a row in the matrix.
2358 @param colno: The number of a column in the matrix.
2359 @param posno: The number of a Jacobian element in the matrix.
2360 @param msg: The actual message.
2362 return libconoptpy4.MessageHandler_errorMessage(self, rowno, colno, posno, msg)
2364 def progress(self, progressdata):
2366 progress(MessageHandler self, ConoptAlgProgress progressdata) -> int
2370 progressdata: ConoptAlgProgress const &
2373 return libconoptpy4.MessageHandler_progress(self, progressdata)
2375 def sendMessage(self, msg):
2377 sends a message to the message handler
2380 @ingroup MESSAGEHANDLER_PYTHON
2382 return libconoptpy4.MessageHandler_sendMessage(self, msg)
2384 def setVerbosityLevel(self, verblevel):
2386 sets the verbosity level for messaging.
2388 The effect of this will depend on how the user implements the custom message handler
2391 @ingroup MESSAGEHANDLER_PYTHON
2393 return libconoptpy4.MessageHandler_setVerbosityLevel(self, verblevel)
2394 def __disown__(self):
2396 libconoptpy4.disown_MessageHandler(self)
2397 return weakref.proxy(self)
2399# Register MessageHandler in libconoptpy4:
2400libconoptpy4.MessageHandler_swigregister(MessageHandler)
2401EvaluationMode_TermsOnly = libconoptpy4.EvaluationMode_TermsOnly
2402r""" only the nonlinear terms will be evaluated."""
2403EvaluationMode_JacobianOnly = libconoptpy4.EvaluationMode_JacobianOnly
2404r""" only the Jacobian of the nonlinear terms will be evaluated."""
2405EvaluationMode_Both = libconoptpy4.EvaluationMode_Both
2406r""" both the nonlinear terms and Jacobian will be evaluated."""
2407class ModelData(ConoptModelData):
2409 A class that can be extended to build and solve a model using Conopt.
2411 This class is the base class that is used for the extended interfaces for Conopt, namely Python and Java. The
2412 virtual methods included in this class can be redefined in the native languages.
2414 @ingroup MODELDATA_PYTHON
2417 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
2418 __repr__ = _swig_repr
2422 __init__(ModelData self) -> ModelData
2429 if self.__class__ == ModelData:
2433 libconoptpy4.ModelData_swiginit(self, libconoptpy4.new_ModelData(_self, ))
2434 __swig_destroy__ = libconoptpy4.delete_ModelData
2436 def evaluateNonlinearTerm(self, x, rowno, ignerr, thread):
2438 callback method for evaluating the nonlinear terms in a given row
2440 @param x: the solution vector that needs to be evaluated.
2441 @param rowno: the number for the row in which the nonlinear term exists.
2442 @param ignerr: a boolean to indicate whether the current point is safe or unsafe.
2443 @param thread: the index of the thread from which this method is being called from.
2445 @return the value of the nonlinear terms.
2447 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2449 @ingroup EVAL_NONLINEAR_FUNCTION_PYTHON
2451 return libconoptpy4.ModelData_evaluateNonlinearTerm(self, x, rowno, ignerr, thread)
2453 def evaluateNonlinearJacobian(self, x, rowno, jacnum, ignerr, thread):
2455 callback method for evaluating the jacobian for the nonlinear terms in a given row
2457 @param x: the solution vector that needs to be evaluated.
2458 @param rowno: the number for the row in which the nonlinear term exists.
2459 @param jacnum: vector with a list of column numbers for the nonlinear nonzero Jacobian elements in the row.
2460 @param ignerr: a boolean to indicate whether the current point is safe or unsafe.
2461 @param thread: the index of the thread from which this method is being called from.
2463 @return a vector the length of jacnum that contains the jacobian values for the referenced elements.
2465 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2467 @ingroup EVAL_NONLINEAR_FUNCTION_PYTHON
2469 return libconoptpy4.ModelData_evaluateNonlinearJacobian(self, x, rowno, jacnum, ignerr, thread)
2471 def initFDEvaluation(self, x, rowlist, mode, numthread, ignerr):
2473 callback method for initialising the first derivative evaluation.
2475 If defined, this method will be called each time the point of interest
2476 has changed, and it will define the coming point and tell which constraints
2477 CONOPT will need during the following calls to `evaluateNonlinearTerm` and `evaluateNonlinearJacobian`.
2479 @param x: the solution vector that needs to be evaluated.
2480 @param rowlist: the list of rows that will be evaluated for the given point.
2481 @param mode: the evaluation mode for the current iteration. This is either TermsOnly, JacobianOnly or Both. See
2482 EvaluationMode for more details.
2483 @param numthread: the number of threads that will be used for the following FDEval calls.
2484 @param ignerr: a boolean to indicate whether the current point is safe or unsafe.
2486 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2492 def endFDEvaluation(self, ignerr):
2494 Optional function, if defined, it will be called at the end of the function evaluation stage.
2495 This can be used to clean up any user data generated, such as in `FDEvalIni`, that was used to improve
2496 the efficiency of the function and derivative evaluation.
2498 @param ignerr: a boolean to indicate whether the current point is safe or unsafe.
2500 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2502 @ingroup EVAL_NONLINEAR_FUNCTION_PYTHON
2504 return libconoptpy4.ModelData_endFDEvaluation(self, ignerr)
2506 def evaluateSDLagrangian(self, x, u, hessianrow, hessiancol):
2508 Computes and returns the numerical values of the Lagrangian of the Hessian
2510 @param x: the solution vector that needs to be evaluated.
2511 @param u: the vector of weights on the individual constraints.
2512 @param hessianrow: vector of row numbers of the lower triangular part of the hessian.
2513 @param hessiancol: vector of column numbers of the lower triangular part of the hessian.
2515 returns a vector for the values of the Lagrangian of the Hessian. The length of the vector is of size numHessianNonzeros().
2517 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2519 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2521 return libconoptpy4.ModelData_evaluateSDLagrangian(self, x, u, hessianrow, hessiancol)
2523 def evaluateSDDirLagrangian(self, x, dx, u, newpoint):
2525 computes the directional second derivative for the Lagrangian
2527 @param x: the solution vector that needs to be evaluated.
2528 @param dx: vector with the direction in which the directional second derivatives should be computed.
2529 @param u: the vector of weights on the individual constraints.
2530 @param newpoint: a boolean to indicate whether x has changed. If newpoint is false, the values of dx may have
2533 returns a vector for the directional second derivative. The length of the vector is the number of variables.
2535 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2537 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2539 return libconoptpy4.ModelData_evaluateSDDirLagrangian(self, x, dx, u, newpoint)
2541 def evaluateDirectionalSD(self, x, dx, rowno, jacnum, thread):
2543 computes the directional second derivative for a single constraint
2545 @param x: the solution vector that needs to be evaluated.
2546 @param dx: vector with the direction in which the directional second derivatives should be computed.
2547 @param rowno: the number for the row in which the nonlinear term exists.
2548 @param jacnum: vector with a list of column numbers for the nonlinear nonzero Jacobian elements in the row.
2549 @param thread: the index of the thread from which this method is being called from.
2551 returns a vector for the directional second derivative. The length of the vector is the number of variables.
2553 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2555 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2557 return libconoptpy4.ModelData_evaluateDirectionalSD(self, x, dx, rowno, jacnum, thread)
2559 def initDirectionalSDEval(self, x, dx, rowlist, numthread, newpoint):
2561 a callback for the initialisation of the second derivative evaluation.
2563 This method is called before a sequence of calls to evaluateDirectionalSD(). The user can utilise this method
2564 for evaluating common terms and storing important information.
2566 @param x: the solution vector that needs to be evaluated.
2567 @param dx: vector with the direction in which the directional second derivatives should be computed.
2568 @param rowlist: the list of rows that will be evaluated for the given point.
2569 @param numthread: the number of threads that will be used for the following FDEval calls.
2570 @param newpoint: a boolean to indicate whether x has changed. If newpoint is false, the values of dx may have
2573 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2579 def endDirectionalSDEval(self):
2581 called by CONOPT after a sequence of evaluateDirectionalSD() calls each time either the point or the direction
2584 It can be used to perform cleanup tasks, including to report if anything went wrong.
2586 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2588 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2590 return libconoptpy4.ModelData_endDirectionalSDEval(self)
2592 def errorInEvaluation(self):
2594 reports that an error occurred in the evaluation.
2596 When executing evaluateNonlinearTerm() or evaluateNonlinearJacobian() the number of errors are counted and then
2597 if an error limit is exceeded, CONOPT will terminate.
2599 When evaluating second derivative information, any errors reported will inform CONOPT that it is unable to use
2600 second order methods for the current point.
2602 return libconoptpy4.ModelData_errorInEvaluation(self)
2604 def setProblemDimension(self, numvar, numcons, numnz, numnlnz):
2606 sets the problem dimension. This is called if the user wants to implement a custom readMatrix() method.
2608 NOTE: it is not possible to call setProblemDimension() and addConstraint() or addVariable(). The latter
2609 functions can only be used if the problem dimension is not set and the default readMatrix() method is used.
2612 @ingroup DEFINE_MODEL_PYTHON
2614 @param numvar: the number of variables in the problem
2615 @param numcons: the number of constraints in the problem
2616 @param numnz: the number of non-zeros in the constraint matrix
2617 @param numnlnz: the number of nonlinear non-zeros in the constraint matrix
2619 return libconoptpy4.ModelData_setProblemDimension(self, numvar, numcons, numnz, numnlnz)
2621 def addConstraint(self, *args):
2624 adds a constraint to the problem. The non-zero coefficients are added later
2627 @ingroup DEFINE_MODEL_PYTHON
2629 @param constype: the type of constraint, 0: ==, 1: >=, 2: <=, 3: free
2630 @param rhs: the right hand side
2631 @param slackstatus: initial status of the slack variables, see IniStat
2636 adds a constraint to the problem. The non-zero coefficients are added later
2639 @ingroup DEFINE_MODEL_PYTHON
2641 @param constype: the type of constraint, 0: ==, 1: >=, 2: <=, 3: free
2642 @param rhs: the right hand side
2643 @param slackstatus: initial status of the slack variables, see IniStat
2648 adds a constraint to the problem. The matrix non-zeros are added based on the supplied variables
2651 @ingroup DEFINE_MODEL_PYTHON
2653 @param constype: the type of constraint, 0: ==, 1: >=, 2: <=, 3: free
2654 @param rhs: the right hand side
2655 @param varindex: the variables this constraint has non-zero coefficients
2656 @param value: the non-zero of the variable
2657 @param nlflag: flag to set whether the variable belongs to a non-linear term
2658 @param slackstatus: initial status of the slack variables, see IniStat
2663 adds a constraint to the problem. The matrix non-zeros are added based on the supplied variables
2666 @ingroup DEFINE_MODEL_PYTHON
2668 @param constype: the type of constraint, 0: ==, 1: >=, 2: <=, 3: free
2669 @param rhs: the right hand side
2670 @param varindex: the variables this constraint has non-zero coefficients
2671 @param value: the non-zero of the variable
2672 @param nlflag: flag to set whether the variable belongs to a non-linear term
2673 @param slackstatus: initial status of the slack variables, see IniStat
2675 return libconoptpy4.ModelData_addConstraint(self, *args)
2677 def addVariable(self, *args):
2680 adds a variable to the model. The non-zero coefficients are added later.
2683 @ingroup DEFINE_MODEL_PYTHON
2685 @param lower: lower bound for the variable
2686 @param upper: upper bound for the variable
2687 @param curr: initial value of the variable, can be set to 0
2688 @param varstatus: initial status of the variable, see IniStat
2693 adds a variable to the model. The non-zero coefficients are added later.
2696 @ingroup DEFINE_MODEL_PYTHON
2698 @param lower: lower bound for the variable
2699 @param upper: upper bound for the variable
2700 @param curr: initial value of the variable, can be set to 0
2701 @param varstatus: initial status of the variable, see IniStat
2706 adds a variable to the model. The non-zero coefficients are added later.
2709 @ingroup DEFINE_MODEL_PYTHON
2711 @param lower: lower bound for the variable
2712 @param upper: upper bound for the variable
2713 @param curr: initial value of the variable, can be set to 0
2714 @param varstatus: initial status of the variable, see IniStat
2719 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
2722 @ingroup DEFINE_MODEL_PYTHON
2724 @param lower: lower bound for the variable
2725 @param upper: upper bound for the variable
2726 @param consindex: the constraints this variable has non-zero coefficients
2727 @param value: the non-zero of the variable
2728 @param nlflag: flag to set whether the variable belongs to a non-linear term
2729 @param curr: initial value of the variable, can be set to 0
2730 @param varstatus: initial status of the variable, see IniStat
2735 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
2738 @ingroup DEFINE_MODEL_PYTHON
2740 @param lower: lower bound for the variable
2741 @param upper: upper bound for the variable
2742 @param consindex: the constraints this variable has non-zero coefficients
2743 @param value: the non-zero of the variable
2744 @param nlflag: flag to set whether the variable belongs to a non-linear term
2745 @param curr: initial value of the variable, can be set to 0
2746 @param varstatus: initial status of the variable, see IniStat
2751 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
2754 @ingroup DEFINE_MODEL_PYTHON
2756 @param lower: lower bound for the variable
2757 @param upper: upper bound for the variable
2758 @param consindex: the constraints this variable has non-zero coefficients
2759 @param value: the non-zero of the variable
2760 @param nlflag: flag to set whether the variable belongs to a non-linear term
2761 @param curr: initial value of the variable, can be set to 0
2762 @param varstatus: initial status of the variable, see IniStat
2764 return libconoptpy4.ModelData_addVariable(self, *args)
2766 def setObjectiveElement(self, elem, elemindex):
2768 sets the index for the objective variable or constraint
2771 @ingroup DEFINE_MODEL_PYTHON
2773 return libconoptpy4.ModelData_setObjectiveElement(self, elem, elemindex)
2775 def setOptimizationSense(self, sense):
2777 sets the optimisation direction.
2780 @ingroup DEFINE_MODEL_PYTHON
2782 return libconoptpy4.ModelData_setOptimizationSense(self, sense)
2784 def setInitialStatusOption(self, inistat):
2786 the setting to indicate how the initial status of the variables and slack variables will be handled.
2788 The initial status is set in the addVariable() and addConstraint() methods, or in the readMatrix() method if the
2789 classical model input approach is used. By default, the value of inistat is 0, which means that the variable and
2790 slack status is ignored.
2793 The variable status has the following behaviour:
2794 - 0: The variable is initialized non-basic (if curr = lower or curr = upper) or super-basic, and
2795 - 1: The variable is initialized basic
2796 The slack status has the following behaviour:
2797 - 0: The slack is initialized non-basic (if the constraint is binding in the initial point) or super-basic,
2798 - 1: The slack is initialized basic
2801 The variable status has the following behaviour:
2802 - 0: The variable is initialized at lower bound
2803 - 1: The variable is initialized at upper bound
2804 - 2: The variable is initialized basic, and
2805 - 3: The variable is initialized superbasic.
2806 The slack status has the following behaviour:
2807 - 0: The slack is initialized at lower bound.
2808 - 1: The slack is initialized at upper bound.
2809 - 2: The slack is initialized basic, and
2810 - 3: The slack is initialized superbasic.
2813 @ingroup DEFINE_MODEL_PYTHON
2815 return libconoptpy4.ModelData_setInitialStatusOption(self, inistat)
2819 returns the number of variables in the model
2822 @ingroup QUERY_MODEL_PYTHON
2824 return libconoptpy4.ModelData_numVar(self)
2828 returns the number of constraints in the model
2831 @ingroup QUERY_MODEL_PYTHON
2833 return libconoptpy4.ModelData_numCons(self)
2835 def numHessianNonzeros(self):
2837 returns the number of non-zeros in the Hessian
2840 @ingroup QUERY_MODEL_PYTHON
2842 return libconoptpy4.ModelData_numHessianNonzeros(self)
2844 def getVariable(self, *args):
2847 returns a reference to the variable object
2850 @ingroup QUERY_MODEL_PYTHON
2855 returns a reference to the variable object
2858 @ingroup QUERY_MODEL_PYTHON
2860 return libconoptpy4.ModelData_getVariable(self, *args)
2862 def getConstraint(self, *args):
2865 returns a reference to the constraint object
2868 @ingroup QUERY_MODEL_PYTHON
2873 returns a reference to the constraint object
2876 @ingroup QUERY_MODEL_PYTHON
2878 return libconoptpy4.ModelData_getConstraint(self, *args)
2880 def setSDEvaluationType(self, sdevaltype):
2882 informs CONOPT of the method for evaluating the second derivative
2885 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2887 return libconoptpy4.ModelData_setSDEvaluationType(self, sdevaltype)
2889 def setSDLagrangianStructure(self, rownum, colnum):
2891 sets the structure of the second derivatives of the Lagrangian
2894 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2896 @param rownum: Vector of row numbers of the lower triangular part of the Hessian.
2897 @param colnum: Vector of column numbers of the lower triangular part of the Hessian.
2899 return libconoptpy4.ModelData_setSDLagrangianStructure(self, rownum, colnum)
2900 def __disown__(self):
2902 libconoptpy4.disown_ModelData(self)
2903 return weakref.proxy(self)
2905# Register ModelData in libconoptpy4:
2906libconoptpy4.ModelData_swigregister(ModelData)
Proxy of C++ swig::SwigPyIterator class.
__init__(self, *args, **kwargs)
incr(self, n=1)
incr(SwigPyIterator self, size_t n=1) -> SwigPyIterator
distance(self, x)
distance(SwigPyIterator self, SwigPyIterator x) -> ptrdiff_t
copy(self)
copy(SwigPyIterator self) -> SwigPyIterator
decr(self, n=1)
decr(SwigPyIterator self, size_t n=1) -> SwigPyIterator
equal(self, x)
equal(SwigPyIterator self, SwigPyIterator x) -> bool
value(self)
value(SwigPyIterator self) -> PyObject *
_swig_setattr_nondynamic_instance_variable(set)
_swig_add_metaclass(metaclass)
Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six....
_swig_setattr_nondynamic_class_variable(set)