12if getattr(globals().get(
"__spec__"),
"parent",
None)
or __package__
or "." in __name__:
13 from .
import libconoptpy4
17import builtins
as __builtin__
21 strthis =
"proxy of " + self.this.__repr__()
22 except __builtin__.Exception:
24 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
28 def set_instance_attr(self, name, value):
30 set(self, name, value)
31 elif name ==
"thisown":
33 elif hasattr(self, name)
and isinstance(getattr(type(self), name), property):
34 set(self, name, value)
36 raise AttributeError(
"You cannot add instance attributes to %s" % self)
37 return set_instance_attr
41 def set_class_attr(cls, name, value):
42 if hasattr(cls, name)
and not isinstance(getattr(cls, name), property):
45 raise AttributeError(
"You cannot add class attributes to %s" % cls)
50 """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
57 r"""Proxy of C++ swig::SwigPyIterator class."""
59 thisown = property(
lambda x: x.this.own(),
lambda x, v: x.this.own(v), doc=
"The membership flag")
62 raise AttributeError(
"No constructor defined - class is abstract")
64 __swig_destroy__ = libconoptpy4.delete_SwigPyIterator
67 r"""value(SwigPyIterator self) -> PyObject *"""
68 return libconoptpy4.SwigPyIterator_value(self)
72 incr(SwigPyIterator self, size_t n=1) -> SwigPyIterator
79 return libconoptpy4.SwigPyIterator_incr(self, n)
83 decr(SwigPyIterator self, size_t n=1) -> SwigPyIterator
90 return libconoptpy4.SwigPyIterator_decr(self, n)
94 distance(SwigPyIterator self, SwigPyIterator x) -> ptrdiff_t
98 x: swig::SwigPyIterator const &
101 return libconoptpy4.SwigPyIterator_distance(self, x)
105 equal(SwigPyIterator self, SwigPyIterator x) -> bool
109 x: swig::SwigPyIterator const &
112 return libconoptpy4.SwigPyIterator_equal(self, x)
115 r"""copy(SwigPyIterator self) -> SwigPyIterator"""
116 return libconoptpy4.SwigPyIterator_copy(self)
119 r"""__next__(SwigPyIterator self) -> PyObject *"""
120 return libconoptpy4.SwigPyIterator___next__(self)
123 r"""previous(SwigPyIterator self) -> PyObject *"""
124 return libconoptpy4.SwigPyIterator_previous(self)
126 def advance(self, n):
128 advance(SwigPyIterator self, ptrdiff_t n) -> SwigPyIterator
135 return libconoptpy4.SwigPyIterator_advance(self, n)
139 __eq__(SwigPyIterator self, SwigPyIterator x) -> bool
143 x: swig::SwigPyIterator const &
146 return libconoptpy4.SwigPyIterator___eq__(self, x)
150 __ne__(SwigPyIterator self, SwigPyIterator x) -> bool
154 x: swig::SwigPyIterator const &
157 return libconoptpy4.SwigPyIterator___ne__(self, x)
159 def __iadd__(self, n):
161 __iadd__(SwigPyIterator self, ptrdiff_t n) -> SwigPyIterator
168 return libconoptpy4.SwigPyIterator___iadd__(self, n)
170 def __isub__(self, n):
172 __isub__(SwigPyIterator self, ptrdiff_t n) -> SwigPyIterator
179 return libconoptpy4.SwigPyIterator___isub__(self, n)
181 def __add__(self, n):
183 __add__(SwigPyIterator self, ptrdiff_t n) -> SwigPyIterator
190 return libconoptpy4.SwigPyIterator___add__(self, n)
192 def __sub__(self, *args):
194 __sub__(SwigPyIterator self, ptrdiff_t n) -> SwigPyIterator
200 __sub__(SwigPyIterator self, SwigPyIterator x) -> ptrdiff_t
204 x: swig::SwigPyIterator const &
207 return libconoptpy4.SwigPyIterator___sub__(self, *args)
211# Register SwigPyIterator in libconoptpy4:
212libconoptpy4.SwigPyIterator_swigregister(SwigPyIterator)
213class IntVector(object):
214 r"""Proxy of C++ std::vector< int > class."""
216 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
217 __repr__ = _swig_repr
220 r"""iterator(IntVector self) -> SwigPyIterator"""
221 return libconoptpy4.IntVector_iterator(self)
223 return self.iterator()
226 r"""__bool__(IntVector self) -> bool"""
227 return libconoptpy4.IntVector___bool__(self)
230 r"""__len__(IntVector self) -> std::vector< int >::size_type"""
231 return libconoptpy4.IntVector___len__(self)
233 def __delitem__(self, *args):
235 __delitem__(IntVector self, std::vector< int >::difference_type i)
239 i: std::vector< int >::difference_type
241 __delitem__(IntVector self, SWIGPY_SLICEOBJECT * slice)
245 slice: SWIGPY_SLICEOBJECT *
248 return libconoptpy4.IntVector___delitem__(self, *args)
250 def __getitem__(self, *args):
252 __getitem__(IntVector self, SWIGPY_SLICEOBJECT * slice) -> IntVector
256 slice: SWIGPY_SLICEOBJECT *
258 __getitem__(IntVector self, std::vector< int >::difference_type i) -> std::vector< int >::value_type const &
262 i: std::vector< int >::difference_type
265 return libconoptpy4.IntVector___getitem__(self, *args)
267 def __setitem__(self, *args):
269 __setitem__(IntVector self, SWIGPY_SLICEOBJECT * slice, IntVector v)
273 slice: SWIGPY_SLICEOBJECT *
274 v: std::vector< int,std::allocator< int > > const &
276 __setitem__(IntVector self, SWIGPY_SLICEOBJECT * slice)
280 slice: SWIGPY_SLICEOBJECT *
282 __setitem__(IntVector self, std::vector< int >::difference_type i, std::vector< int >::value_type const & x)
286 i: std::vector< int >::difference_type
287 x: std::vector< int >::value_type const &
290 return libconoptpy4.IntVector___setitem__(self, *args)
293 r"""pop(IntVector self) -> std::vector< int >::value_type"""
294 return libconoptpy4.IntVector_pop(self)
298 append(IntVector self, std::vector< int >::value_type const & x)
302 x: std::vector< int >::value_type const &
305 return libconoptpy4.IntVector_append(self, x)
308 r"""empty(IntVector self) -> bool"""
309 return libconoptpy4.IntVector_empty(self)
312 r"""size(IntVector self) -> std::vector< int >::size_type"""
313 return libconoptpy4.IntVector_size(self)
317 swap(IntVector self, IntVector v)
321 v: std::vector< int > &
324 return libconoptpy4.IntVector_swap(self, v)
327 r"""begin(IntVector self) -> std::vector< int >::iterator"""
328 return libconoptpy4.IntVector_begin(self)
331 r"""end(IntVector self) -> std::vector< int >::iterator"""
332 return libconoptpy4.IntVector_end(self)
335 r"""rbegin(IntVector self) -> std::vector< int >::reverse_iterator"""
336 return libconoptpy4.IntVector_rbegin(self)
339 r"""rend(IntVector self) -> std::vector< int >::reverse_iterator"""
340 return libconoptpy4.IntVector_rend(self)
343 r"""clear(IntVector self)"""
344 return libconoptpy4.IntVector_clear(self)
346 def get_allocator(self):
347 r"""get_allocator(IntVector self) -> std::vector< int >::allocator_type"""
348 return libconoptpy4.IntVector_get_allocator(self)
351 r"""pop_back(IntVector self)"""
352 return libconoptpy4.IntVector_pop_back(self)
354 def erase(self, *args):
356 erase(IntVector self, std::vector< int >::iterator pos) -> std::vector< int >::iterator
360 pos: std::vector< int >::iterator
362 erase(IntVector self, std::vector< int >::iterator first, std::vector< int >::iterator last) -> std::vector< int >::iterator
366 first: std::vector< int >::iterator
367 last: std::vector< int >::iterator
370 return libconoptpy4.IntVector_erase(self, *args)
372 def __init__(self, *args):
374 __init__(IntVector self) -> IntVector
375 __init__(IntVector self, IntVector other) -> IntVector
379 other: std::vector< int > const &
381 __init__(IntVector self, std::vector< int >::size_type size) -> IntVector
385 size: std::vector< int >::size_type
387 __init__(IntVector self, std::vector< int >::size_type size, std::vector< int >::value_type const & value) -> IntVector
391 size: std::vector< int >::size_type
392 value: std::vector< int >::value_type const &
395 libconoptpy4.IntVector_swiginit(self, libconoptpy4.new_IntVector(*args))
397 def push_back(self, x):
399 push_back(IntVector self, std::vector< int >::value_type const & x)
403 x: std::vector< int >::value_type const &
406 return libconoptpy4.IntVector_push_back(self, x)
409 r"""front(IntVector self) -> std::vector< int >::value_type const &"""
410 return libconoptpy4.IntVector_front(self)
413 r"""back(IntVector self) -> std::vector< int >::value_type const &"""
414 return libconoptpy4.IntVector_back(self)
416 def assign(self, n, x):
418 assign(IntVector self, std::vector< int >::size_type n, std::vector< int >::value_type const & x)
422 n: std::vector< int >::size_type
423 x: std::vector< int >::value_type const &
426 return libconoptpy4.IntVector_assign(self, n, x)
428 def resize(self, *args):
430 resize(IntVector self, std::vector< int >::size_type new_size)
434 new_size: std::vector< int >::size_type
436 resize(IntVector self, std::vector< int >::size_type new_size, std::vector< int >::value_type const & x)
440 new_size: std::vector< int >::size_type
441 x: std::vector< int >::value_type const &
444 return libconoptpy4.IntVector_resize(self, *args)
446 def insert(self, *args):
448 insert(IntVector self, std::vector< int >::iterator pos, std::vector< int >::value_type const & x) -> std::vector< int >::iterator
452 pos: std::vector< int >::iterator
453 x: std::vector< int >::value_type const &
455 insert(IntVector self, std::vector< int >::iterator pos, std::vector< int >::size_type n, std::vector< int >::value_type const & x)
459 pos: std::vector< int >::iterator
460 n: std::vector< int >::size_type
461 x: std::vector< int >::value_type const &
464 return libconoptpy4.IntVector_insert(self, *args)
466 def reserve(self, n):
468 reserve(IntVector self, std::vector< int >::size_type n)
472 n: std::vector< int >::size_type
475 return libconoptpy4.IntVector_reserve(self, n)
478 r"""capacity(IntVector self) -> std::vector< int >::size_type"""
479 return libconoptpy4.IntVector_capacity(self)
480 __swig_destroy__ = libconoptpy4.delete_IntVector
482# Register IntVector in libconoptpy4:
483libconoptpy4.IntVector_swigregister(IntVector)
484class DoubleVector(object):
485 r"""Proxy of C++ std::vector< double > class."""
487 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
488 __repr__ = _swig_repr
491 r"""iterator(DoubleVector self) -> SwigPyIterator"""
492 return libconoptpy4.DoubleVector_iterator(self)
494 return self.iterator()
497 r"""__bool__(DoubleVector self) -> bool"""
498 return libconoptpy4.DoubleVector___bool__(self)
501 r"""__len__(DoubleVector self) -> std::vector< double >::size_type"""
502 return libconoptpy4.DoubleVector___len__(self)
504 def __delitem__(self, *args):
506 __delitem__(DoubleVector self, std::vector< double >::difference_type i)
510 i: std::vector< double >::difference_type
512 __delitem__(DoubleVector self, SWIGPY_SLICEOBJECT * slice)
516 slice: SWIGPY_SLICEOBJECT *
519 return libconoptpy4.DoubleVector___delitem__(self, *args)
521 def __getitem__(self, *args):
523 __getitem__(DoubleVector self, SWIGPY_SLICEOBJECT * slice) -> DoubleVector
527 slice: SWIGPY_SLICEOBJECT *
529 __getitem__(DoubleVector self, std::vector< double >::difference_type i) -> std::vector< double >::value_type const &
533 i: std::vector< double >::difference_type
536 return libconoptpy4.DoubleVector___getitem__(self, *args)
538 def __setitem__(self, *args):
540 __setitem__(DoubleVector self, SWIGPY_SLICEOBJECT * slice, DoubleVector v)
544 slice: SWIGPY_SLICEOBJECT *
545 v: std::vector< double,std::allocator< double > > const &
547 __setitem__(DoubleVector self, SWIGPY_SLICEOBJECT * slice)
551 slice: SWIGPY_SLICEOBJECT *
553 __setitem__(DoubleVector self, std::vector< double >::difference_type i, std::vector< double >::value_type const & x)
557 i: std::vector< double >::difference_type
558 x: std::vector< double >::value_type const &
561 return libconoptpy4.DoubleVector___setitem__(self, *args)
564 r"""pop(DoubleVector self) -> std::vector< double >::value_type"""
565 return libconoptpy4.DoubleVector_pop(self)
569 append(DoubleVector self, std::vector< double >::value_type const & x)
573 x: std::vector< double >::value_type const &
576 return libconoptpy4.DoubleVector_append(self, x)
579 r"""empty(DoubleVector self) -> bool"""
580 return libconoptpy4.DoubleVector_empty(self)
583 r"""size(DoubleVector self) -> std::vector< double >::size_type"""
584 return libconoptpy4.DoubleVector_size(self)
588 swap(DoubleVector self, DoubleVector v)
592 v: std::vector< double > &
595 return libconoptpy4.DoubleVector_swap(self, v)
598 r"""begin(DoubleVector self) -> std::vector< double >::iterator"""
599 return libconoptpy4.DoubleVector_begin(self)
602 r"""end(DoubleVector self) -> std::vector< double >::iterator"""
603 return libconoptpy4.DoubleVector_end(self)
606 r"""rbegin(DoubleVector self) -> std::vector< double >::reverse_iterator"""
607 return libconoptpy4.DoubleVector_rbegin(self)
610 r"""rend(DoubleVector self) -> std::vector< double >::reverse_iterator"""
611 return libconoptpy4.DoubleVector_rend(self)
614 r"""clear(DoubleVector self)"""
615 return libconoptpy4.DoubleVector_clear(self)
617 def get_allocator(self):
618 r"""get_allocator(DoubleVector self) -> std::vector< double >::allocator_type"""
619 return libconoptpy4.DoubleVector_get_allocator(self)
622 r"""pop_back(DoubleVector self)"""
623 return libconoptpy4.DoubleVector_pop_back(self)
625 def erase(self, *args):
627 erase(DoubleVector self, std::vector< double >::iterator pos) -> std::vector< double >::iterator
631 pos: std::vector< double >::iterator
633 erase(DoubleVector self, std::vector< double >::iterator first, std::vector< double >::iterator last) -> std::vector< double >::iterator
637 first: std::vector< double >::iterator
638 last: std::vector< double >::iterator
641 return libconoptpy4.DoubleVector_erase(self, *args)
643 def __init__(self, *args):
645 __init__(DoubleVector self) -> DoubleVector
646 __init__(DoubleVector self, DoubleVector other) -> DoubleVector
650 other: std::vector< double > const &
652 __init__(DoubleVector self, std::vector< double >::size_type size) -> DoubleVector
656 size: std::vector< double >::size_type
658 __init__(DoubleVector self, std::vector< double >::size_type size, std::vector< double >::value_type const & value) -> DoubleVector
662 size: std::vector< double >::size_type
663 value: std::vector< double >::value_type const &
666 libconoptpy4.DoubleVector_swiginit(self, libconoptpy4.new_DoubleVector(*args))
668 def push_back(self, x):
670 push_back(DoubleVector self, std::vector< double >::value_type const & x)
674 x: std::vector< double >::value_type const &
677 return libconoptpy4.DoubleVector_push_back(self, x)
680 r"""front(DoubleVector self) -> std::vector< double >::value_type const &"""
681 return libconoptpy4.DoubleVector_front(self)
684 r"""back(DoubleVector self) -> std::vector< double >::value_type const &"""
685 return libconoptpy4.DoubleVector_back(self)
687 def assign(self, n, x):
689 assign(DoubleVector self, std::vector< double >::size_type n, std::vector< double >::value_type const & x)
693 n: std::vector< double >::size_type
694 x: std::vector< double >::value_type const &
697 return libconoptpy4.DoubleVector_assign(self, n, x)
699 def resize(self, *args):
701 resize(DoubleVector self, std::vector< double >::size_type new_size)
705 new_size: std::vector< double >::size_type
707 resize(DoubleVector self, std::vector< double >::size_type new_size, std::vector< double >::value_type const & x)
711 new_size: std::vector< double >::size_type
712 x: std::vector< double >::value_type const &
715 return libconoptpy4.DoubleVector_resize(self, *args)
717 def insert(self, *args):
719 insert(DoubleVector self, std::vector< double >::iterator pos, std::vector< double >::value_type const & x) -> std::vector< double >::iterator
723 pos: std::vector< double >::iterator
724 x: std::vector< double >::value_type const &
726 insert(DoubleVector self, std::vector< double >::iterator pos, std::vector< double >::size_type n, std::vector< double >::value_type const & x)
730 pos: std::vector< double >::iterator
731 n: std::vector< double >::size_type
732 x: std::vector< double >::value_type const &
735 return libconoptpy4.DoubleVector_insert(self, *args)
737 def reserve(self, n):
739 reserve(DoubleVector self, std::vector< double >::size_type n)
743 n: std::vector< double >::size_type
746 return libconoptpy4.DoubleVector_reserve(self, n)
749 r"""capacity(DoubleVector self) -> std::vector< double >::size_type"""
750 return libconoptpy4.DoubleVector_capacity(self)
751 __swig_destroy__ = libconoptpy4.delete_DoubleVector
753# Register DoubleVector in libconoptpy4:
754libconoptpy4.DoubleVector_swigregister(DoubleVector)
755class StringVector(object):
756 r"""Proxy of C++ std::vector< std::string > class."""
758 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
759 __repr__ = _swig_repr
762 r"""iterator(StringVector self) -> SwigPyIterator"""
763 return libconoptpy4.StringVector_iterator(self)
765 return self.iterator()
768 r"""__bool__(StringVector self) -> bool"""
769 return libconoptpy4.StringVector___bool__(self)
772 r"""__len__(StringVector self) -> std::vector< std::string >::size_type"""
773 return libconoptpy4.StringVector___len__(self)
775 def __delitem__(self, *args):
777 __delitem__(StringVector self, std::vector< std::string >::difference_type i)
781 i: std::vector< std::string >::difference_type
783 __delitem__(StringVector self, SWIGPY_SLICEOBJECT * slice)
787 slice: SWIGPY_SLICEOBJECT *
790 return libconoptpy4.StringVector___delitem__(self, *args)
792 def __getitem__(self, *args):
794 __getitem__(StringVector self, SWIGPY_SLICEOBJECT * slice) -> StringVector
798 slice: SWIGPY_SLICEOBJECT *
800 __getitem__(StringVector self, std::vector< std::string >::difference_type i) -> std::vector< std::string >::value_type const &
804 i: std::vector< std::string >::difference_type
807 return libconoptpy4.StringVector___getitem__(self, *args)
809 def __setitem__(self, *args):
811 __setitem__(StringVector self, SWIGPY_SLICEOBJECT * slice, StringVector v)
815 slice: SWIGPY_SLICEOBJECT *
816 v: std::vector< std::string,std::allocator< std::string > > const &
818 __setitem__(StringVector self, SWIGPY_SLICEOBJECT * slice)
822 slice: SWIGPY_SLICEOBJECT *
824 __setitem__(StringVector self, std::vector< std::string >::difference_type i, std::vector< std::string >::value_type const & x)
828 i: std::vector< std::string >::difference_type
829 x: std::vector< std::string >::value_type const &
832 return libconoptpy4.StringVector___setitem__(self, *args)
835 r"""pop(StringVector self) -> std::vector< std::string >::value_type"""
836 return libconoptpy4.StringVector_pop(self)
840 append(StringVector self, std::vector< std::string >::value_type const & x)
844 x: std::vector< std::string >::value_type const &
847 return libconoptpy4.StringVector_append(self, x)
850 r"""empty(StringVector self) -> bool"""
851 return libconoptpy4.StringVector_empty(self)
854 r"""size(StringVector self) -> std::vector< std::string >::size_type"""
855 return libconoptpy4.StringVector_size(self)
859 swap(StringVector self, StringVector v)
863 v: std::vector< std::string > &
866 return libconoptpy4.StringVector_swap(self, v)
869 r"""begin(StringVector self) -> std::vector< std::string >::iterator"""
870 return libconoptpy4.StringVector_begin(self)
873 r"""end(StringVector self) -> std::vector< std::string >::iterator"""
874 return libconoptpy4.StringVector_end(self)
877 r"""rbegin(StringVector self) -> std::vector< std::string >::reverse_iterator"""
878 return libconoptpy4.StringVector_rbegin(self)
881 r"""rend(StringVector self) -> std::vector< std::string >::reverse_iterator"""
882 return libconoptpy4.StringVector_rend(self)
885 r"""clear(StringVector self)"""
886 return libconoptpy4.StringVector_clear(self)
888 def get_allocator(self):
889 r"""get_allocator(StringVector self) -> std::vector< std::string >::allocator_type"""
890 return libconoptpy4.StringVector_get_allocator(self)
893 r"""pop_back(StringVector self)"""
894 return libconoptpy4.StringVector_pop_back(self)
896 def erase(self, *args):
898 erase(StringVector self, std::vector< std::string >::iterator pos) -> std::vector< std::string >::iterator
902 pos: std::vector< std::string >::iterator
904 erase(StringVector self, std::vector< std::string >::iterator first, std::vector< std::string >::iterator last) -> std::vector< std::string >::iterator
908 first: std::vector< std::string >::iterator
909 last: std::vector< std::string >::iterator
912 return libconoptpy4.StringVector_erase(self, *args)
914 def __init__(self, *args):
916 __init__(StringVector self) -> StringVector
917 __init__(StringVector self, StringVector other) -> StringVector
921 other: std::vector< std::string > const &
923 __init__(StringVector self, std::vector< std::string >::size_type size) -> StringVector
927 size: std::vector< std::string >::size_type
929 __init__(StringVector self, std::vector< std::string >::size_type size, std::vector< std::string >::value_type const & value) -> StringVector
933 size: std::vector< std::string >::size_type
934 value: std::vector< std::string >::value_type const &
937 libconoptpy4.StringVector_swiginit(self, libconoptpy4.new_StringVector(*args))
939 def push_back(self, x):
941 push_back(StringVector self, std::vector< std::string >::value_type const & x)
945 x: std::vector< std::string >::value_type const &
948 return libconoptpy4.StringVector_push_back(self, x)
951 r"""front(StringVector self) -> std::vector< std::string >::value_type const &"""
952 return libconoptpy4.StringVector_front(self)
955 r"""back(StringVector self) -> std::vector< std::string >::value_type const &"""
956 return libconoptpy4.StringVector_back(self)
958 def assign(self, n, x):
960 assign(StringVector self, std::vector< std::string >::size_type n, std::vector< std::string >::value_type const & x)
964 n: std::vector< std::string >::size_type
965 x: std::vector< std::string >::value_type const &
968 return libconoptpy4.StringVector_assign(self, n, x)
970 def resize(self, *args):
972 resize(StringVector self, std::vector< std::string >::size_type new_size)
976 new_size: std::vector< std::string >::size_type
978 resize(StringVector self, std::vector< std::string >::size_type new_size, std::vector< std::string >::value_type const & x)
982 new_size: std::vector< std::string >::size_type
983 x: std::vector< std::string >::value_type const &
986 return libconoptpy4.StringVector_resize(self, *args)
988 def insert(self, *args):
990 insert(StringVector self, std::vector< std::string >::iterator pos, std::vector< std::string >::value_type const & x) -> std::vector< std::string >::iterator
994 pos: std::vector< std::string >::iterator
995 x: std::vector< std::string >::value_type const &
997 insert(StringVector self, std::vector< std::string >::iterator pos, std::vector< std::string >::size_type n, std::vector< std::string >::value_type const & x)
1001 pos: std::vector< std::string >::iterator
1002 n: std::vector< std::string >::size_type
1003 x: std::vector< std::string >::value_type const &
1006 return libconoptpy4.StringVector_insert(self, *args)
1008 def reserve(self, n):
1010 reserve(StringVector self, std::vector< std::string >::size_type n)
1014 n: std::vector< std::string >::size_type
1017 return libconoptpy4.StringVector_reserve(self, n)
1020 r"""capacity(StringVector self) -> std::vector< std::string >::size_type"""
1021 return libconoptpy4.StringVector_capacity(self)
1022 __swig_destroy__ = libconoptpy4.delete_StringVector
1024# Register StringVector in libconoptpy4:
1025libconoptpy4.StringVector_swigregister(StringVector)
1026class IntArray3(object):
1027 r"""Proxy of C++ std::array< int,3 > class."""
1029 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
1030 __repr__ = _swig_repr
1033 r"""iterator(IntArray3 self) -> SwigPyIterator"""
1034 return libconoptpy4.IntArray3_iterator(self)
1036 return self.iterator()
1039 r"""__bool__(IntArray3 self) -> bool"""
1040 return libconoptpy4.IntArray3___bool__(self)
1043 r"""__len__(IntArray3 self) -> std::array< int,3 >::size_type"""
1044 return libconoptpy4.IntArray3___len__(self)
1046 def __delitem__(self, *args):
1048 __delitem__(IntArray3 self, std::array< int,3 >::difference_type i)
1052 i: std::array< int,3 >::difference_type
1054 __delitem__(IntArray3 self, SWIGPY_SLICEOBJECT * slice)
1058 slice: SWIGPY_SLICEOBJECT *
1061 return libconoptpy4.IntArray3___delitem__(self, *args)
1063 def __getitem__(self, *args):
1065 __getitem__(IntArray3 self, SWIGPY_SLICEOBJECT * slice) -> IntArray3
1069 slice: SWIGPY_SLICEOBJECT *
1071 __getitem__(IntArray3 self, std::array< int,3 >::difference_type i) -> std::array< int,3 >::value_type const &
1075 i: std::array< int,3 >::difference_type
1078 return libconoptpy4.IntArray3___getitem__(self, *args)
1080 def __setitem__(self, *args):
1082 __setitem__(IntArray3 self, SWIGPY_SLICEOBJECT * slice, IntArray3 v)
1086 slice: SWIGPY_SLICEOBJECT *
1087 v: std::array< int,3 > const &
1089 __setitem__(IntArray3 self, SWIGPY_SLICEOBJECT * slice)
1093 slice: SWIGPY_SLICEOBJECT *
1095 __setitem__(IntArray3 self, std::array< int,3 >::difference_type i, std::array< int,3 >::value_type const & x)
1099 i: std::array< int,3 >::difference_type
1100 x: std::array< int,3 >::value_type const &
1103 return libconoptpy4.IntArray3___setitem__(self, *args)
1105 def __init__(self, *args):
1107 __init__(IntArray3 self) -> IntArray3
1108 __init__(IntArray3 self, IntArray3 other) -> IntArray3
1112 other: std::array< int,3 > const &
1115 libconoptpy4.IntArray3_swiginit(self, libconoptpy4.new_IntArray3(*args))
1118 r"""empty(IntArray3 self) -> bool"""
1119 return libconoptpy4.IntArray3_empty(self)
1122 r"""size(IntArray3 self) -> std::array< int,3 >::size_type"""
1123 return libconoptpy4.IntArray3_size(self)
1127 swap(IntArray3 self, IntArray3 v)
1131 v: std::array< int,3 > &
1134 return libconoptpy4.IntArray3_swap(self, v)
1137 r"""begin(IntArray3 self) -> std::array< int,3 >::iterator"""
1138 return libconoptpy4.IntArray3_begin(self)
1141 r"""end(IntArray3 self) -> std::array< int,3 >::iterator"""
1142 return libconoptpy4.IntArray3_end(self)
1145 r"""rbegin(IntArray3 self) -> std::array< int,3 >::reverse_iterator"""
1146 return libconoptpy4.IntArray3_rbegin(self)
1149 r"""rend(IntArray3 self) -> std::array< int,3 >::reverse_iterator"""
1150 return libconoptpy4.IntArray3_rend(self)
1153 r"""front(IntArray3 self) -> std::array< int,3 >::value_type const &"""
1154 return libconoptpy4.IntArray3_front(self)
1157 r"""back(IntArray3 self) -> std::array< int,3 >::value_type const &"""
1158 return libconoptpy4.IntArray3_back(self)
1162 fill(IntArray3 self, std::array< int,3 >::value_type const & u)
1166 u: std::array< int,3 >::value_type const &
1169 return libconoptpy4.IntArray3_fill(self, u)
1170 __swig_destroy__ = libconoptpy4.delete_IntArray3
1172# Register IntArray3 in libconoptpy4:
1173libconoptpy4.IntArray3_swigregister(IntArray3)
1174class Conopt(object):
1178 @ingroup CONOPT_PYTHON
1181 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
1182 __repr__ = _swig_repr
1183 Infinity = libconoptpy4.Conopt_Infinity
1184 r"""CONOPT value for infinity"""
1186 def __init__(self, *args):
1190 @param modelName: the name for the model.
1193 libconoptpy4.Conopt_swiginit(self, libconoptpy4.new_Conopt(*args))
1194 __swig_destroy__ = libconoptpy4.delete_Conopt
1198 @copydoc DEF_COI_SOLVE
1201 @ingroup UTILITY_ROUTINES_PYTHON
1203 return libconoptpy4.Conopt_solve(self)
1205 def checkModelAndParameters(self):
1206 r"""checks the model data and parameters to ensure it is setup correctly"""
1207 return libconoptpy4.Conopt_checkModelAndParameters(self)
1209 def controlVector(self):
1211 returns the control vector pointer.
1213 This is for use in the C-interface methods
1216 @ingroup UTILITY_ROUTINES_PYTHON
1218 return libconoptpy4.Conopt_controlVector(self)
1220 def printStatus(self):
1222 prints the status of the optimisation
1225 @ingroup UTILITY_ROUTINES_PYTHON
1227 return libconoptpy4.Conopt_printStatus(self)
1231 returns the model name
1234 @ingroup UTILITY_ROUTINES_PYTHON
1236 return libconoptpy4.Conopt_getName(self)
1238 def loadModel(self, modeldata):
1240 loads the model and stores the pointer in the interface
1242 The user creates an instantiation of the ConoptModelData that includes all details of the model, including
1243 function evaluation callbacks. This method loads the model data into Conopt before solving the problem.
1245 @param modeldata: a user defined ConoptModelData object
1248 @ingroup CONOPTPYTHON_MODELDATA
1250 return libconoptpy4.Conopt_loadModel(self, modeldata)
1252 def modelStatus(self):
1254 returns the model status
1257 return libconoptpy4.Conopt_modelStatus(self)
1259 def solutionStatus(self):
1261 return the solution status
1264 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1266 return libconoptpy4.Conopt_solutionStatus(self)
1268 def iterations(self):
1270 returns the number of iterations
1273 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1275 return libconoptpy4.Conopt_iterations(self)
1277 def objectiveValue(self):
1279 returns the objective value
1282 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1284 return libconoptpy4.Conopt_objectiveValue(self)
1286 def getVariableValues(self):
1288 returns the variable values
1291 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1293 return libconoptpy4.Conopt_getVariableValues(self)
1295 def getVariableMarginals(self):
1297 returns the variable marginals
1300 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1302 return libconoptpy4.Conopt_getVariableMarginals(self)
1304 def getVariableBasisStatus(self):
1306 returns the variable basis status
1309 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1311 return libconoptpy4.Conopt_getVariableBasisStatus(self)
1313 def getVariableStatus(self):
1315 returns the variable status
1318 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1320 return libconoptpy4.Conopt_getVariableStatus(self)
1322 def getConstraintValues(self):
1324 returns the constraint values
1327 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1329 return libconoptpy4.Conopt_getConstraintValues(self)
1331 def getConstraintMarginals(self):
1333 returns the constraint marginals
1336 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1338 return libconoptpy4.Conopt_getConstraintMarginals(self)
1340 def getConstraintBasisStatus(self):
1342 returns the constraint basis status
1345 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1347 return libconoptpy4.Conopt_getConstraintBasisStatus(self)
1349 def getConstraintStatus(self):
1351 returns the constraint status
1354 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1356 return libconoptpy4.Conopt_getConstraintStatus(self)
1358 def setMessageHandler(self, msghandler):
1360 sets the message handler to the user supplied handler.
1362 The pointer to the supplied message handler is stored in the interface object. The user is responsible for the
1363 creation and destruction of the message handler object.
1365 @param msghandler: a user defined ConoptMessageHandler object
1368 @ingroup CONOPTPYTHON_MESSAGEHANDLER
1370 return libconoptpy4.Conopt_setMessageHandler(self, msghandler)
1372 def sendMessage(self, msg):
1374 sends a message to the message handler
1376 @param msg: A string for the message that will be processed in the message handler
1379 @ingroup CONOPTPYTHON_MESSAGEHANDLER
1381 return libconoptpy4.Conopt_sendMessage(self, msg)
1383 def setVerbosityLevel(self, verblevel):
1385 sets the verbosity level for messaging
1387 The verbosity level is:
1388 - None -- turn off all output
1389 - Normal -- normal output, iteration log to stdout and error to stderr
1390 - Error -- more detailed iteration log to stdout, error to stdout and stderr
1391 - Debug -- extensive iteration log, error to stdout and stderr
1393 @param verblevel: the verbosity level for the message handler
1396 @ingroup CONOPTPYTHON_MESSAGEHANDLER
1398 return libconoptpy4.Conopt_setVerbosityLevel(self, verblevel)
1403 returns the version number.
1405 It can be used to ensure that the modeler is linked to the correct version of the CONOPT DLL.
1408 @ingroup UTILITY_ROUTINES_PYTHON
1410 return libconoptpy4.Conopt_version()
1412 def debugFV(self, debugfv):
1414 @copydoc DEF_COI_DEBUGFV
1417 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1419 return libconoptpy4.Conopt_debugFV(self, debugfv)
1421 def squareModel(self, square):
1423 @copydoc DEF_COI_SQUARE
1426 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1428 return libconoptpy4.Conopt_squareModel(self, square)
1430 def setLicense(self, licint1, licint2, licint3, licstring):
1432 @copydoc DEF_COI_LICENSE
1435 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1437 return libconoptpy4.Conopt_setLicense(self, licint1, licint2, licint3, licstring)
1439 def setItLim(self, itlim):
1441 @copydoc DEF_COI_ITLIM
1444 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1446 return libconoptpy4.Conopt_setItLim(self, itlim)
1448 def setErrLim(self, errlim):
1450 @copydoc DEF_COI_ERRLIM
1453 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1455 return libconoptpy4.Conopt_setErrLim(self, errlim)
1457 def fVincLin(self, fvinclin):
1459 @copydoc DEF_COI_FVINCLIN
1462 @ingroup REGISTRATION_OF_SIZES_PYTHON
1464 return libconoptpy4.Conopt_fVincLin(self, fvinclin)
1466 def fVforAll(self, fvforall):
1468 @copydoc DEF_COI_FVFORALL
1471 @ingroup REGISTRATION_OF_SIZES_PYTHON
1473 return libconoptpy4.Conopt_fVforAll(self, fvforall)
1475 def setMaxSup(self, maxsup):
1477 @copydoc DEF_COI_MAXSUP
1480 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1482 return libconoptpy4.Conopt_setMaxSup(self, maxsup)
1484 def allowEmptyRow(self, emptyrow):
1486 @copydoc DEF_COI_EMPTYROW
1489 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1491 return libconoptpy4.Conopt_allowEmptyRow(self, emptyrow)
1493 def allowEmptyCol(self, emptycol):
1495 @copydoc DEF_COI_EMPTYCOL
1498 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1500 return libconoptpy4.Conopt_allowEmptyCol(self, emptycol)
1502 def debug2D(self, debug2d):
1504 @copydoc DEF_COI_DEBUG2D
1507 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1509 return libconoptpy4.Conopt_debug2D(self, debug2d)
1511 def disCont(self, discont):
1513 @copydoc DEF_COI_DISCONT
1516 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1518 return libconoptpy4.Conopt_disCont(self, discont)
1520 def clearM(self, clearm):
1522 @copydoc DEF_COI_CLEARM
1525 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1527 return libconoptpy4.Conopt_clearM(self, clearm)
1529 def setResLim(self, reslim):
1531 @copydoc DEF_COI_RESLIM
1534 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1536 return libconoptpy4.Conopt_setResLim(self, reslim)
1538 def setMaxHeap(self, maxheap):
1540 @copydoc DEF_COI_MAXHEAP
1543 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1545 return libconoptpy4.Conopt_setMaxHeap(self, maxheap)
1547 def setThreadS(self, threads):
1549 @copydoc DEF_COI_THREADS
1552 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1554 return libconoptpy4.Conopt_setThreadS(self, threads)
1556 def setThreadF(self, threadf):
1558 @copydoc DEF_COI_THREADF
1561 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1563 return libconoptpy4.Conopt_setThreadF(self, threadf)
1565 def setThread2D(self, thread2d):
1567 @copydoc DEF_COI_THREAD2D
1570 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1572 return libconoptpy4.Conopt_setThread2D(self, thread2d)
1574 def setThreadC(self, threadc):
1576 @copydoc DEF_COI_THREADC
1579 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1581 return libconoptpy4.Conopt_setThreadC(self, threadc)
1583 def getMaxThreads(self):
1585 returns the maximum number of threads that can be used by CONOPT.
1587 If you are using multiple threads it may be necessary to know in advance how many threads CONOPT can use. If
1588 called inside a parallel loop, this method will return one---indicating that CONOPT cannot use multiple
1589 threads when CONOPT itself is called in parallel. Therefore, this method should be called in some sequential
1590 initialization code and not inside a function evaluation routine, that could be called in parallel.
1593 @ingroup UTILITY_ROUTINES_PYTHON
1595 return libconoptpy4.Conopt_getMaxThreads(self)
1597 def getMaxHeapUsed(self):
1599 After a model has been solved this method will return the amount of heap memory used.
1602 @ingroup UTILITY_ROUTINES_PYTHON
1604 return libconoptpy4.Conopt_getMaxHeapUsed(self)
1606 def getRangeErrors(self):
1608 returns the range errors that were encountered.
1611 @ingroup UTILITY_ROUTINES_PYTHON
1613 return libconoptpy4.Conopt_getRangeErrors(self)
1615# Register Conopt in libconoptpy4:
1616libconoptpy4.Conopt_swigregister(Conopt)
1617ConstraintType_Eq = libconoptpy4.ConstraintType_Eq
1618r"""equality constraint"""
1619ConstraintType_GtEq = libconoptpy4.ConstraintType_GtEq
1620r"""greater than or equal to constraint"""
1621ConstraintType_LtEq = libconoptpy4.ConstraintType_LtEq
1622r"""lesser than or equal to constraint"""
1623ConstraintType_Free = libconoptpy4.ConstraintType_Free
1624r"""an unrestricted constraint. This is used when specifying the objective function."""
1625ObjectiveElement_Variable = libconoptpy4.ObjectiveElement_Variable
1626r"""the objective is given by a single variable"""
1627ObjectiveElement_Constraint = libconoptpy4.ObjectiveElement_Constraint
1628r"""the objective is given by the value of an equation"""
1629Sense_Minimize = libconoptpy4.Sense_Minimize
1630r"""a minimisation problem (default)"""
1631Sense_Maximize = libconoptpy4.Sense_Maximize
1632r"""a maximisation problem"""
1633SDEvaluationType__None = libconoptpy4.SDEvaluationType__None
1635SDEvaluationType_Constraint = libconoptpy4.SDEvaluationType_Constraint
1637SDEvaluationType_Lagrangian = libconoptpy4.SDEvaluationType_Lagrangian
1639class Variable(object):
1643 This struct is used internally for supplying the variable data to CONOPT. The user is able to query this data from
1644 the ConoptModelData object. However, the user is not able to change the data after the variable has been added to
1648 @ingroup QUERY_MODEL_PYTHON
1651 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
1652 __repr__ = _swig_repr
1654 def __init__(self, idx, low, up, cur=0, varstat=-1):
1656 __init__(Variable self, int idx, double low, double up, double cur=0, int varstat=-1) -> Variable
1667 libconoptpy4.Variable_swiginit(self, libconoptpy4.new_Variable(idx, low, up, cur, varstat))
1669 def addNonzero(self, conindex, value, nlflag):
1671 adds a non-zero to the variable data
1673 Notes: this is used internally.
1675 return libconoptpy4.Variable_addNonzero(self, conindex, value, nlflag)
1677 def sortNonzeros(self):
1679 sorts the non-zeros by constraint index.
1681 Notes: this is used internally.
1683 return libconoptpy4.Variable_sortNonzeros(self)
1684 index = property(libconoptpy4.Variable_index_get, libconoptpy4.Variable_index_set, doc=
r"""the index of the variable in the problem""")
1685 lower = property(libconoptpy4.Variable_lower_get, libconoptpy4.Variable_lower_set, doc=
r"""the lower bound of the variable""")
1686 upper = property(libconoptpy4.Variable_upper_get, libconoptpy4.Variable_upper_set, doc=
r"""the upper bound of the variable""")
1687 curr = property(libconoptpy4.Variable_curr_get, libconoptpy4.Variable_curr_set, doc=
r"""the initial value of the variable. This is 0 by default.""")
1688 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.""")
1689 consindex_ = property(libconoptpy4.Variable_consindex__get, libconoptpy4.Variable_consindex__set, doc=
r"""the index of the constraints""")
1690 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""")
1691 nlflag_ = property(libconoptpy4.Variable_nlflag__get, libconoptpy4.Variable_nlflag__set, doc=
r"""indicator whether the non-zero is part of a non-linear term""")
1692 sortorder_ = property(libconoptpy4.Variable_sortorder__get, libconoptpy4.Variable_sortorder__set, doc=
r"""a vector to support the sorting of the non-zeros""")
1693 __swig_destroy__ = libconoptpy4.delete_Variable
1695# Register Variable in libconoptpy4:
1696libconoptpy4.Variable_swigregister(Variable)
1697class Constraint(object):
1701 This struct is used internally for supplying the variable data to CONOPT. The user is able to query this data from
1702 the ConoptModelData object. However, the user is not able to change the data after the variable has been added to
1706 @ingroup QUERY_MODEL_PYTHON
1709 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
1710 __repr__ = _swig_repr
1712 def __init__(self, idx, type, bound, slackstat):
1714 __init__(Constraint self, int idx, ConoptConstraintType type, double bound, int slackstat) -> Constraint
1719 type: enum ConoptConstraintType
1724 libconoptpy4.Constraint_swiginit(self, libconoptpy4.new_Constraint(idx, type, bound, slackstat))
1725 index = property(libconoptpy4.Constraint_index_get, libconoptpy4.Constraint_index_set, doc=
r"""the index of the constraint in the problem""")
1726 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""")
1727 rhs = property(libconoptpy4.Constraint_rhs_get, libconoptpy4.Constraint_rhs_set, doc=
r"""the right hand side of the constraint""")
1728 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.""")
1729 __swig_destroy__ = libconoptpy4.delete_Constraint
1731# Register Constraint in libconoptpy4:
1732libconoptpy4.Constraint_swigregister(Constraint)
1733class ConoptModelData(object):
1734 r"""The Model Data class"""
1736 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
1737 __repr__ = _swig_repr
1741 if self.__class__ == ConoptModelData:
1745 libconoptpy4.ConoptModelData_swiginit(self, libconoptpy4.new_ConoptModelData(_self, ))
1746 __swig_destroy__ = libconoptpy4.delete_ConoptModelData
1748 def readMatrix(self, lower, curr, upper, vsta, type, rhs, esta, colsta, rowno, value, nlflag, numvar, numcon, numnz):
1750 loads the structure of the model into CONOPT.
1752 Using the C++ interface, there are two ways to load the model into CONOPT.
1753 The first method follows the process used for the Fortran and C interfaces. This involves:
1754 1. setting the problem dimension by calling setProblemDimension().
1755 2. set the objective element (constraint or variable) by calling setObjectiveElement().
1756 3. set the optimisation sense by calling setOptimizationSense().
1757 4. implementing a readMatrix() method that loads the model using a column-oriented sparse matrix format. For
1758 more details regarding the parameters of the readMatrix() method, please see 'API_DEFINING_THE_MODEL_F90'
1760 The second method makes use of the convenience functions included in the C++ interface. Within the
1761 ConoptModelData the methods addConstraint() and addVariable() are provided. As such, to load the model into
1763 1. write a member function for building the model.
1764 2. in the build model function, call addVariable() for each variable to be added to the problem.
1765 3. in the build model function, call addConstraint() for each constraint to be added to the problem. When adding
1766 a constraint, you should specify the variables (by index), coefficients and non-linear flags (for all
1768 4. set the objective element (constraint or variable) by calling setObjectiveElement().
1769 5. set the optimisation sense by calling setOptimizationSense().
1770 When the solve method is called, the default readMatrix() method will be called, which will load the model into
1771 CONOPT as specified by the calls to addVariable() and addConstraint().
1775 return libconoptpy4.ConoptModelData_readMatrix(self, lower, curr, upper, vsta, type, rhs, esta, colsta, rowno, value, nlflag, numvar, numcon, numnz)
1777 def setProblemDimension(self, numvar, numcons, numnz, numnlnz):
1779 sets the problem dimension. This is called if the user wants to implement a custom readMatrix() method.
1781 NOTE: it is not possible to call setProblemDimension() and addConstraint() or addVariable(). The latter
1782 functions can only be used if the problem dimension is not set and the default readMatrix() method is used.
1786 @param numvar: the number of variables in the problem
1787 @param numcons: the number of constraints in the problem
1788 @param numnz: the number of non-zeros in the constraint matrix
1789 @param numnlnz: the number of nonlinear non-zeros in the constraint matrix
1791 return libconoptpy4.ConoptModelData_setProblemDimension(self, numvar, numcons, numnz, numnlnz)
1793 def addConstraint(self, *args):
1796 adds a constraint to the problem. The non-zero coefficients are added later
1800 @param constype: the type of constraint, 0: ==, 1: >=, 2: <=, 3: free
1801 @param rhs: the right hand side
1802 @param slackstatus: initial status of the slack variables, see IniStat
1807 adds a constraint to the problem. The matrix non-zeros are added based on the supplied variables
1811 @param constype: the type of constraint, 0: ==, 1: >=, 2: <=, 3: free
1812 @param rhs: the right hand side
1813 @param varindex: the variables this constraint has non-zero coefficients
1814 @param value: the non-zero of the variable
1815 @param nlflag: flag to set whether the variable belongs to a non-linear term
1816 @param slackstatus: initial status of the slack variables, see IniStat
1821 adds a constraint to the problem. The matrix non-zeros are added based on the supplied variables
1825 @param constype: the type of constraint, 0: ==, 1: >=, 2: <=, 3: free
1826 @param rhs: the right hand side
1827 @param varindex: the variables this constraint has non-zero coefficients
1828 @param value: the non-zero of the variable
1829 @param nlflag: flag to set whether the variable belongs to a non-linear term
1830 @param slackstatus: initial status of the slack variables, see IniStat
1832 return libconoptpy4.ConoptModelData_addConstraint(self, *args)
1834 def addVariable(self, *args):
1837 adds a variable to the model. The non-zero coefficients are added later.
1841 @param lower: lower bound for the variable
1842 @param upper: upper bound for the variable
1843 @param curr: initial value of the variable, can be set to 0
1844 @param varstatus: initial status of the variable, see IniStat
1849 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
1853 @param lower: lower bound for the variable
1854 @param upper: upper bound for the variable
1855 @param consindex: the constraints this variable has non-zero coefficients
1856 @param value: the non-zero of the variable
1857 @param nlflag: flag to set whether the variable belongs to a non-linear term
1858 @param curr: initial value of the variable, can be set to 0
1859 @param varstatus: initial status of the variable, see IniStat
1864 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
1868 @param lower: lower bound for the variable
1869 @param upper: upper bound for the variable
1870 @param consindex: the constraints this variable has non-zero coefficients
1871 @param value: the non-zero of the variable
1872 @param nlflag: flag to set whether the variable belongs to a non-linear term
1873 @param curr: initial value of the variable, can be set to 0
1874 @param varstatus: initial status of the variable, see IniStat
1879 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
1883 @param lower: lower bound for the variable
1884 @param upper: upper bound for the variable
1885 @param consindex: the constraints this variable has non-zero coefficients
1886 @param value: the non-zero of the variable
1887 @param nlflag: flag to set whether the variable belongs to a non-linear term
1888 @param curr: initial value of the variable, can be set to 0
1889 @param varstatus: initial status of the variable, see IniStat
1891 return libconoptpy4.ConoptModelData_addVariable(self, *args)
1893 def setObjectiveElement(self, elem, elemindex):
1895 sets the index for the objective variable or constraint
1899 return libconoptpy4.ConoptModelData_setObjectiveElement(self, elem, elemindex)
1901 def setOptimizationSense(self, sense):
1903 sets the optimisation direction.
1907 return libconoptpy4.ConoptModelData_setOptimizationSense(self, sense)
1909 def setInitialStatusOption(self, inistat):
1911 the setting to indicate how the initial status of the variables and slack variables will be handled.
1913 The initial status is set in the addVariable() and addConstraint() methods, or in the readMatrix() method if the
1914 classical model input approach is used. By default, the value of inistat is 0, which means that the variable and
1915 slack status is ignored.
1918 The variable status has the following behaviour:
1919 - 0: The variable is initialized non-basic (if curr = lower or curr = upper) or super-basic, and
1920 - 1: The variable is initialized basic
1921 The slack status has the following behaviour:
1922 - 0: The slack is initialized non-basic (if the constraint is binding in the initial point) or super-basic,
1923 - 1: The slack is initialized basic
1926 The variable status has the following behaviour:
1927 - 0: The variable is initialized at lower bound
1928 - 1: The variable is initialized at upper bound
1929 - 2: The variable is initialized basic, and
1930 - 3: The variable is initialized superbasic.
1931 The slack status has the following behaviour:
1932 - 0: The slack is initialized at lower bound.
1933 - 1: The slack is initialized at upper bound.
1934 - 2: The slack is initialized basic, and
1935 - 3: The slack is initialized superbasic.
1939 return libconoptpy4.ConoptModelData_setInitialStatusOption(self, inistat)
1943 returns the number of variables in the model
1947 return libconoptpy4.ConoptModelData_numVar(self)
1951 returns the number of constraints in the model
1955 return libconoptpy4.ConoptModelData_numCons(self)
1957 def numHessianNonzeros(self):
1959 returns the number of non-zeros in the Hessian
1963 return libconoptpy4.ConoptModelData_numHessianNonzeros(self)
1965 def getVariable(self, *args):
1968 returns a reference to the variable object
1975 returns a reference to the variable object
1979 return libconoptpy4.ConoptModelData_getVariable(self, *args)
1981 def getConstraint(self, *args):
1984 returns a reference to the constraint object
1991 returns a reference to the constraint object
1995 return libconoptpy4.ConoptModelData_getConstraint(self, *args)
1997 def setSDEvaluationType(self, sdevaltype):
1999 informs CONOPT of the method for evaluating the second derivative
2003 return libconoptpy4.ConoptModelData_setSDEvaluationType(self, sdevaltype)
2005 def setSDLagrangianStructure(self, rownum, colnum):
2007 sets the structure of the second derivatives of the Lagrangian
2011 @param rownum: Vector of row numbers of the lower triangular part of the Hessian.
2012 @param colnum: Vector of column numbers of the lower triangular part of the Hessian.
2014 return libconoptpy4.ConoptModelData_setSDLagrangianStructure(self, rownum, colnum)
2016 def getSDLagrangianRowNumbers(self):
2017 r"""returns the row numbers in the second derivative of the lagrangian structure"""
2018 return libconoptpy4.ConoptModelData_getSDLagrangianRowNumbers(self)
2020 def getSDLagrangianColumnNumbers(self):
2021 r"""returns the column numbers in the second derivative of the lagrangian structure"""
2022 return libconoptpy4.ConoptModelData_getSDLagrangianColumnNumbers(self)
2023 def __disown__(self):
2025 libconoptpy4.disown_ConoptModelData(self)
2026 return weakref.proxy(self)
2028# Register ConoptModelData in libconoptpy4:
2029libconoptpy4.ConoptModelData_swigregister(ConoptModelData)
2030VerbosityLevel_VerbLevelMin = libconoptpy4.VerbosityLevel_VerbLevelMin
2032VerbosityLevel__None = libconoptpy4.VerbosityLevel__None
2033r"""turn off all output"""
2034VerbosityLevel_Normal = libconoptpy4.VerbosityLevel_Normal
2035r"""normal output, iteration log to stdout and error to stderr"""
2036VerbosityLevel_Error = libconoptpy4.VerbosityLevel_Error
2037r"""more detailed iteration log to stdout, error to stdout and stderr"""
2038VerbosityLevel_Debug = libconoptpy4.VerbosityLevel_Debug
2039r"""extensive iteration log, error to stdout and stderr"""
2040VerbosityLevel_VerbLevelMax = libconoptpy4.VerbosityLevel_VerbLevelMax
2042class ConoptAlgProgress(object):
2043 r"""Proxy of C++ ConoptAlgProgress class."""
2045 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
2046 __repr__ = _swig_repr
2047 iteration = property(libconoptpy4.ConoptAlgProgress_iteration_get, libconoptpy4.ConoptAlgProgress_iteration_set, doc=
r"""Number of the iteration.""")
2048 phase = property(libconoptpy4.ConoptAlgProgress_phase_get, libconoptpy4.ConoptAlgProgress_phase_set, doc=
r"""The phase of the optimization.""")
2049 numinfeas = property(libconoptpy4.ConoptAlgProgress_numinfeas_get, libconoptpy4.ConoptAlgProgress_numinfeas_set, doc=
r"""
2050 Number of infeasible constraints. In phase 0, this number will only
2051 count the number of "difficult" constraints.
2053 numnopt = property(libconoptpy4.ConoptAlgProgress_numnopt_get, libconoptpy4.ConoptAlgProgress_numnopt_set, doc=
r"""
2054 Number of non-optimal variables. Will be 0 meaning undefined
2057 numsuper = property(libconoptpy4.ConoptAlgProgress_numsuper_get, libconoptpy4.ConoptAlgProgress_numsuper_set, doc=
r"""Number of super-basic variables. Will be zero during phase 0 .""")
2058 suminfeas = property(libconoptpy4.ConoptAlgProgress_suminfeas_get, libconoptpy4.ConoptAlgProgress_suminfeas_set, doc=
r"""
2059 Sum of the infeasibilities. In phase 0 it will include the
2060 infeasibilities in both easy and difficult constraint. During phase
2061 3 and 4 SUMINF will be 0.
2063 objvalue = property(libconoptpy4.ConoptAlgProgress_objvalue_get, libconoptpy4.ConoptAlgProgress_objvalue_set, doc=
r"""
2064 The value of the true objective function. OBJVAL is zero meaning
2065 undefined during phase 0, 1 and 2
2067 rgmax = property(libconoptpy4.ConoptAlgProgress_rgmax_get, libconoptpy4.ConoptAlgProgress_rgmax_set, doc=
r"""
2068 The numerically largest reduced gradient. RGMAX will be zero during
2071 step = property(libconoptpy4.ConoptAlgProgress_step_get, libconoptpy4.ConoptAlgProgress_step_set, doc=
r"""The optimal steplength.""")
2072 numvar = property(libconoptpy4.ConoptAlgProgress_numvar_get, libconoptpy4.ConoptAlgProgress_numvar_set, doc=
r"""The number of variables""")
2075 r"""__init__(ConoptAlgProgress self) -> ConoptAlgProgress"""
2076 libconoptpy4.ConoptAlgProgress_swiginit(self, libconoptpy4.new_ConoptAlgProgress())
2077 __swig_destroy__ = libconoptpy4.delete_ConoptAlgProgress
2079# Register ConoptAlgProgress in libconoptpy4:
2080libconoptpy4.ConoptAlgProgress_swigregister(ConoptAlgProgress)
2081class MessageHandler(object):
2083 The message handler class
2085 @ingroup MESSAGEHANDLER_PYTHON
2088 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
2089 __repr__ = _swig_repr
2093 if self.__class__ == MessageHandler:
2097 libconoptpy4.MessageHandler_swiginit(self, libconoptpy4.new_MessageHandler(_self, ))
2098 __swig_destroy__ = libconoptpy4.delete_MessageHandler
2100 def message(self, smsg, dmsg, nmsg, msgv):
2102 virtual method for handling the messages.
2104 This can be redefined by the user for alternative message handling
2106 @include{doc} message_cb_intro.dox
2109 @ingroup MESSAGEHANDLER_PYTHON
2111 @param smsg: The number of lines in the message that should go to the Screen file. Between 0 and 30.
2112 @param dmsg: The number of lines in the message that should go to the Status file. Between 0 and 30.
2113 @param nmsg: The number of lines in the message that should go to the Documentation file. Between 0 and 30.
2114 @param msgv: Vector with the actual message lines.
2116 return libconoptpy4.MessageHandler_message(self, smsg, dmsg, nmsg, msgv)
2118 def errorMessage(self, rowno, colno, posno, msg):
2120 virtual method for handling error messages.
2122 This can be redefined by the user for alternative message handling
2124 Messages about particular parts of a model are all one line long. The messages
2125 can be related to an error or it can be a general informative message related to
2126 a row or column or Jacobian element. The modeler is responsible for combining
2127 the row and column identification and the message text and for displaying the
2130 There are some special cases for the three first arguments and the message
2131 should be interpreted accordingly. The special cases are:
2133 - **COLNO = -1:** The message is about a row and `ROWNO` will be between 0
2136 - **ROWNO = -1:** The message is about a column and `COLNO` will be between 0
2139 - **ROWNO and COLNO both non-negative:** The message is about a position in
2140 the Jacobian if `POSNO` is non-negative and about a (row,column)-pair if `POSNO`
2143 Examples of message texts are "Inconsistent lower and upper bounds." and "The
2144 variable has reached 'infinity.'" for a column, "The slack has reached
2145 'infinity.'" for a row and "Initial Jacobian element was not defined." for a
2149 @ingroup MESSAGEHANDLER_PYTHON
2151 @param rowno: The number of a row in the matrix.
2152 @param colno: The number of a column in the matrix.
2153 @param posno: The number of a Jacobian element in the matrix.
2154 @param msg: The actual message.
2156 return libconoptpy4.MessageHandler_errorMessage(self, rowno, colno, posno, msg)
2158 def progress(self, progressdata):
2160 progress(MessageHandler self, ConoptAlgProgress progressdata) -> int
2164 progressdata: ConoptAlgProgress const &
2167 return libconoptpy4.MessageHandler_progress(self, progressdata)
2169 def sendMessage(self, msg):
2171 sends a message to the message handler
2174 @ingroup MESSAGEHANDLER_PYTHON
2176 return libconoptpy4.MessageHandler_sendMessage(self, msg)
2178 def setVerbosityLevel(self, verblevel):
2180 sets the verbosity level for messaging.
2182 The effect of this will depend on how the user implements the custom message handler
2185 @ingroup MESSAGEHANDLER_PYTHON
2187 return libconoptpy4.MessageHandler_setVerbosityLevel(self, verblevel)
2188 def __disown__(self):
2190 libconoptpy4.disown_MessageHandler(self)
2191 return weakref.proxy(self)
2193# Register MessageHandler in libconoptpy4:
2194libconoptpy4.MessageHandler_swigregister(MessageHandler)
2195EvaluationMode_TermsOnly = libconoptpy4.EvaluationMode_TermsOnly
2196r"""only the nonlinear terms will be evaluated."""
2197EvaluationMode_JacobianOnly = libconoptpy4.EvaluationMode_JacobianOnly
2198r"""only the Jacobian of the nonlinear terms will be evaluated."""
2199EvaluationMode_Both = libconoptpy4.EvaluationMode_Both
2200r"""both the nonlinear terms and Jacobian will be evaluated."""
2201class ModelData(ConoptModelData):
2203 A class that can be extended to build and solve a model using Conopt.
2205 This class is the base class that is used for the extended interfaces for Conopt, namely Python and Java. The
2206 virtual methods included in this class can be redefined in the native languages.
2208 @ingroup MODELDATA_PYTHON
2211 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
2212 __repr__ = _swig_repr
2216 __init__(ModelData self) -> ModelData
2223 if self.__class__ == ModelData:
2227 libconoptpy4.ModelData_swiginit(self, libconoptpy4.new_ModelData(_self, ))
2228 __swig_destroy__ = libconoptpy4.delete_ModelData
2230 def evaluateNonlinearTerm(self, x, rowno, ignerr, thread):
2232 callback method for evaluating the nonlinear terms in a given row
2234 @param x: the solution vector that needs to be evaluated.
2235 @param rowno: the number for the row in which the nonlinear term exists.
2236 @param ignerr: a boolean to indicate whether the current point is safe or unsafe.
2237 @param thread: the index of the thread from which this method is being called from.
2239 @return the value of the nonlinear terms.
2241 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2243 @ingroup EVAL_NONLINEAR_FUNCTION_PYTHON
2245 return libconoptpy4.ModelData_evaluateNonlinearTerm(self, x, rowno, ignerr, thread)
2247 def evaluateNonlinearJacobian(self, x, rowno, jacnum, ignerr, thread):
2249 callback method for evaluating the jacobian for the nonlinear terms in a given row
2251 @param x: the solution vector that needs to be evaluated.
2252 @param rowno: the number for the row in which the nonlinear term exists.
2253 @param jacnum: vector with a list of column numbers for the nonlinear nonzero Jacobian elements in the row.
2254 @param ignerr: a boolean to indicate whether the current point is safe or unsafe.
2255 @param thread: the index of the thread from which this method is being called from.
2257 @return a vector the length of jacnum that contains the jacobian values for the referenced elements.
2259 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2261 @ingroup EVAL_NONLINEAR_FUNCTION_PYTHON
2263 return libconoptpy4.ModelData_evaluateNonlinearJacobian(self, x, rowno, jacnum, ignerr, thread)
2265 def initFDEvaluation(self, x, rowlist, mode, numthread, ignerr):
2267 callback method for initialising the first derivative evaluation.
2269 If defined, this method will be called each time the point of interest
2270 has changed, and it will define the coming point and tell which constraints
2271 CONOPT will need during the following calls to `evaluateNonlinearTerm` and `evaluateNonlinearJacobian`.
2273 @param x: the solution vector that needs to be evaluated.
2274 @param rowlist: the list of rows that will be evaluated for the given point.
2275 @param mode: the evaluation mode for the current iteration. This is either TermsOnly, JacobianOnly or Both. See
2276 EvaluationMode for more details.
2277 @param numthread: the number of threads that will be used for the following FDEval calls.
2278 @param ignerr: a boolean to indicate whether the current point is safe or unsafe.
2280 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2286 def endFDEvaluation(self, ignerr):
2288 Optional function, if defined, it will be called at the end of the function evaluation stage.
2289 This can be used to clean up any user data generated, such as in `FDEvalIni`, that was used to improve
2290 the efficiency of the function and derivative evaluation.
2292 @param ignerr: a boolean to indicate whether the current point is safe or unsafe.
2294 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2296 @ingroup EVAL_NONLINEAR_FUNCTION_PYTHON
2298 return libconoptpy4.ModelData_endFDEvaluation(self, ignerr)
2300 def evaluateSDLagrangian(self, x, u, hessianrow, hessiancol):
2302 Computes and returns the numerical values of the Lagrangian of the Hessian
2304 @param x: the solution vector that needs to be evaluated.
2305 @param u: the vector of weights on the individual constraints.
2306 @param hessianrow: vector of row numbers of the lower triangular part of the hessian.
2307 @param hessiancol: vector of column numbers of the lower triangular part of the hessian.
2309 returns a vector for the values of the Lagrangian of the Hessian. The length of the vector is of size numHessianNonzeros().
2311 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2313 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2315 return libconoptpy4.ModelData_evaluateSDLagrangian(self, x, u, hessianrow, hessiancol)
2317 def evaluateSDDirLagrangian(self, x, dx, u, newpoint):
2319 computes the directional second derivative for the Lagrangian
2321 @param x: the solution vector that needs to be evaluated.
2322 @param dx: vector with the direction in which the directional second derivatives should be computed.
2323 @param u: the vector of weights on the individual constraints.
2324 @param newpoint: a boolean to indicate whether x has changed. If newpoint is false, the values of dx may have
2327 returns a vector for the directional second derivative. The length of the vector is the number of variables.
2329 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2331 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2333 return libconoptpy4.ModelData_evaluateSDDirLagrangian(self, x, dx, u, newpoint)
2335 def evaluateDirectionalSD(self, x, dx, rowno, jacnum, thread):
2337 computes the directional second derivative for a single constraint
2339 @param x: the solution vector that needs to be evaluated.
2340 @param dx: vector with the direction in which the directional second derivatives should be computed.
2341 @param rowno: the number for the row in which the nonlinear term exists.
2342 @param jacnum: vector with a list of column numbers for the nonlinear nonzero Jacobian elements in the row.
2343 @param thread: the index of the thread from which this method is being called from.
2345 returns a vector for the directional second derivative. The length of the vector is the number of variables.
2347 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2349 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2351 return libconoptpy4.ModelData_evaluateDirectionalSD(self, x, dx, rowno, jacnum, thread)
2353 def initDirectionalSDEval(self, x, dx, rowlist, numthread, newpoint):
2355 a callback for the initialisation of the second derivative evaluation.
2357 This method is called before a sequence of calls to evaluateDirectionalSD(). The user can utilise this method
2358 for evaluating common terms and storing important information.
2360 @param x: the solution vector that needs to be evaluated.
2361 @param dx: vector with the direction in which the directional second derivatives should be computed.
2362 @param rowlist: the list of rows that will be evaluated for the given point.
2363 @param numthread: the number of threads that will be used for the following FDEval calls.
2364 @param newpoint: a boolean to indicate whether x has changed. If newpoint is false, the values of dx may have
2367 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2373 def endDirectionalSDEval(self):
2375 called by CONOPT after a sequence of evaluateDirectionalSD() calls each time either the point or the direction
2378 It can be used to perform cleanup tasks, including to report if anything went wrong.
2380 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2382 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2384 return libconoptpy4.ModelData_endDirectionalSDEval(self)
2386 def errorInEvaluation(self):
2388 reports that an error occurred in the evaluation.
2390 When executing evaluateNonlinearTerm() or evaluateNonlinearJacobian() the number of errors are counted and then
2391 if an error limit is exceeded, CONOPT will terminate.
2393 When evaluating second derivative information, any errors reported will inform CONOPT that it is unable to use
2394 second order methods for the current point.
2396 return libconoptpy4.ModelData_errorInEvaluation(self)
2398 def setProblemDimension(self, numvar, numcons, numnz, numnlnz):
2400 sets the problem dimension. This is called if the user wants to implement a custom readMatrix() method.
2402 NOTE: it is not possible to call setProblemDimension() and addConstraint() or addVariable(). The latter
2403 functions can only be used if the problem dimension is not set and the default readMatrix() method is used.
2406 @ingroup DEFINE_MODEL_PYTHON
2408 @param numvar: the number of variables in the problem
2409 @param numcons: the number of constraints in the problem
2410 @param numnz: the number of non-zeros in the constraint matrix
2411 @param numnlnz: the number of nonlinear non-zeros in the constraint matrix
2413 return libconoptpy4.ModelData_setProblemDimension(self, numvar, numcons, numnz, numnlnz)
2415 def addConstraint(self, *args):
2418 adds a constraint to the problem. The non-zero coefficients are added later
2421 @ingroup DEFINE_MODEL_PYTHON
2423 @param constype: the type of constraint, 0: ==, 1: >=, 2: <=, 3: free
2424 @param rhs: the right hand side
2425 @param slackstatus: initial status of the slack variables, see IniStat
2430 adds a constraint to the problem. The non-zero coefficients are added later
2433 @ingroup DEFINE_MODEL_PYTHON
2435 @param constype: the type of constraint, 0: ==, 1: >=, 2: <=, 3: free
2436 @param rhs: the right hand side
2437 @param slackstatus: initial status of the slack variables, see IniStat
2442 adds a constraint to the problem. The matrix non-zeros are added based on the supplied variables
2445 @ingroup DEFINE_MODEL_PYTHON
2447 @param constype: the type of constraint, 0: ==, 1: >=, 2: <=, 3: free
2448 @param rhs: the right hand side
2449 @param varindex: the variables this constraint has non-zero coefficients
2450 @param value: the non-zero of the variable
2451 @param nlflag: flag to set whether the variable belongs to a non-linear term
2452 @param slackstatus: initial status of the slack variables, see IniStat
2457 adds a constraint to the problem. The matrix non-zeros are added based on the supplied variables
2460 @ingroup DEFINE_MODEL_PYTHON
2462 @param constype: the type of constraint, 0: ==, 1: >=, 2: <=, 3: free
2463 @param rhs: the right hand side
2464 @param varindex: the variables this constraint has non-zero coefficients
2465 @param value: the non-zero of the variable
2466 @param nlflag: flag to set whether the variable belongs to a non-linear term
2467 @param slackstatus: initial status of the slack variables, see IniStat
2469 return libconoptpy4.ModelData_addConstraint(self, *args)
2471 def addVariable(self, *args):
2474 adds a variable to the model. The non-zero coefficients are added later.
2477 @ingroup DEFINE_MODEL_PYTHON
2479 @param lower: lower bound for the variable
2480 @param upper: upper bound for the variable
2481 @param curr: initial value of the variable, can be set to 0
2482 @param varstatus: initial status of the variable, see IniStat
2487 adds a variable to the model. The non-zero coefficients are added later.
2490 @ingroup DEFINE_MODEL_PYTHON
2492 @param lower: lower bound for the variable
2493 @param upper: upper bound for the variable
2494 @param curr: initial value of the variable, can be set to 0
2495 @param varstatus: initial status of the variable, see IniStat
2500 adds a variable to the model. The non-zero coefficients are added later.
2503 @ingroup DEFINE_MODEL_PYTHON
2505 @param lower: lower bound for the variable
2506 @param upper: upper bound for the variable
2507 @param curr: initial value of the variable, can be set to 0
2508 @param varstatus: initial status of the variable, see IniStat
2513 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
2516 @ingroup DEFINE_MODEL_PYTHON
2518 @param lower: lower bound for the variable
2519 @param upper: upper bound for the variable
2520 @param consindex: the constraints this variable has non-zero coefficients
2521 @param value: the non-zero of the variable
2522 @param nlflag: flag to set whether the variable belongs to a non-linear term
2523 @param curr: initial value of the variable, can be set to 0
2524 @param varstatus: initial status of the variable, see IniStat
2529 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
2532 @ingroup DEFINE_MODEL_PYTHON
2534 @param lower: lower bound for the variable
2535 @param upper: upper bound for the variable
2536 @param consindex: the constraints this variable has non-zero coefficients
2537 @param value: the non-zero of the variable
2538 @param nlflag: flag to set whether the variable belongs to a non-linear term
2539 @param curr: initial value of the variable, can be set to 0
2540 @param varstatus: initial status of the variable, see IniStat
2545 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
2548 @ingroup DEFINE_MODEL_PYTHON
2550 @param lower: lower bound for the variable
2551 @param upper: upper bound for the variable
2552 @param consindex: the constraints this variable has non-zero coefficients
2553 @param value: the non-zero of the variable
2554 @param nlflag: flag to set whether the variable belongs to a non-linear term
2555 @param curr: initial value of the variable, can be set to 0
2556 @param varstatus: initial status of the variable, see IniStat
2558 return libconoptpy4.ModelData_addVariable(self, *args)
2560 def setObjectiveElement(self, elem, elemindex):
2562 sets the index for the objective variable or constraint
2565 @ingroup DEFINE_MODEL_PYTHON
2567 return libconoptpy4.ModelData_setObjectiveElement(self, elem, elemindex)
2569 def setOptimizationSense(self, sense):
2571 sets the optimisation direction.
2574 @ingroup DEFINE_MODEL_PYTHON
2576 return libconoptpy4.ModelData_setOptimizationSense(self, sense)
2578 def setInitialStatusOption(self, inistat):
2580 the setting to indicate how the initial status of the variables and slack variables will be handled.
2582 The initial status is set in the addVariable() and addConstraint() methods, or in the readMatrix() method if the
2583 classical model input approach is used. By default, the value of inistat is 0, which means that the variable and
2584 slack status is ignored.
2587 The variable status has the following behaviour:
2588 - 0: The variable is initialized non-basic (if curr = lower or curr = upper) or super-basic, and
2589 - 1: The variable is initialized basic
2590 The slack status has the following behaviour:
2591 - 0: The slack is initialized non-basic (if the constraint is binding in the initial point) or super-basic,
2592 - 1: The slack is initialized basic
2595 The variable status has the following behaviour:
2596 - 0: The variable is initialized at lower bound
2597 - 1: The variable is initialized at upper bound
2598 - 2: The variable is initialized basic, and
2599 - 3: The variable is initialized superbasic.
2600 The slack status has the following behaviour:
2601 - 0: The slack is initialized at lower bound.
2602 - 1: The slack is initialized at upper bound.
2603 - 2: The slack is initialized basic, and
2604 - 3: The slack is initialized superbasic.
2607 @ingroup DEFINE_MODEL_PYTHON
2609 return libconoptpy4.ModelData_setInitialStatusOption(self, inistat)
2613 returns the number of variables in the model
2616 @ingroup QUERY_MODEL_PYTHON
2618 return libconoptpy4.ModelData_numVar(self)
2622 returns the number of constraints in the model
2625 @ingroup QUERY_MODEL_PYTHON
2627 return libconoptpy4.ModelData_numCons(self)
2629 def numHessianNonzeros(self):
2631 returns the number of non-zeros in the Hessian
2634 @ingroup QUERY_MODEL_PYTHON
2636 return libconoptpy4.ModelData_numHessianNonzeros(self)
2638 def getVariable(self, *args):
2641 returns a reference to the variable object
2644 @ingroup QUERY_MODEL_PYTHON
2649 returns a reference to the variable object
2652 @ingroup QUERY_MODEL_PYTHON
2654 return libconoptpy4.ModelData_getVariable(self, *args)
2656 def getConstraint(self, *args):
2659 returns a reference to the constraint object
2662 @ingroup QUERY_MODEL_PYTHON
2667 returns a reference to the constraint object
2670 @ingroup QUERY_MODEL_PYTHON
2672 return libconoptpy4.ModelData_getConstraint(self, *args)
2674 def setSDEvaluationType(self, sdevaltype):
2676 informs CONOPT of the method for evaluating the second derivative
2679 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2681 return libconoptpy4.ModelData_setSDEvaluationType(self, sdevaltype)
2683 def setSDLagrangianStructure(self, rownum, colnum):
2685 sets the structure of the second derivatives of the Lagrangian
2688 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2690 @param rownum: Vector of row numbers of the lower triangular part of the Hessian.
2691 @param colnum: Vector of column numbers of the lower triangular part of the Hessian.
2693 return libconoptpy4.ModelData_setSDLagrangianStructure(self, rownum, colnum)
2694 def __disown__(self):
2696 libconoptpy4.disown_ModelData(self)
2697 return weakref.proxy(self)
2699# Register ModelData in libconoptpy4:
2700libconoptpy4.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_setattr_nondynamic_class_variable(set)