CONOPT
Loading...
Searching...
No Matches
conopt.py
Go to the documentation of this file.
1
3
4# This file was automatically generated by SWIG (https://www.swig.org).
5# Version 4.2.1
6#
7# Do not make changes to this file unless you know what you are doing - modify
8# the SWIG interface file instead.
9
10from sys import version_info as _swig_python_version_info
11# Import the low-level C/C++ module
12if __package__ or "." in __name__:
13 from . import libconoptpy4
14else:
15 import libconoptpy4
16
17try:
18 import builtins as __builtin__
19except ImportError:
20 import __builtin__
21
22def _swig_repr(self):
23 try:
24 strthis = "proxy of " + self.this.__repr__()
25 except __builtin__.Exception:
26 strthis = ""
27 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
28
29
31 def set_instance_attr(self, name, value):
32 if name == "this":
33 set(self, name, value)
34 elif name == "thisown":
35 self.this.own(value)
36 elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
37 set(self, name, value)
38 else:
39 raise AttributeError("You cannot add instance attributes to %s" % self)
40 return set_instance_attr
41
42
44 def set_class_attr(cls, name, value):
45 if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
46 set(cls, name, value)
47 else:
48 raise AttributeError("You cannot add class attributes to %s" % cls)
49 return set_class_attr
50
51
52def _swig_add_metaclass(metaclass):
53 """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
54 def wrapper(cls):
55 return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
56 return wrapper
57
58
60 """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
61 __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)
62
63
64import weakref
65
66class SwigPyIterator(object):
67 r"""Proxy of C++ swig::SwigPyIterator class."""
68
69 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
70
71 def __init__(self, *args, **kwargs):
72 raise AttributeError("No constructor defined - class is abstract")
73 __repr__ = _swig_repr
74 __swig_destroy__ = libconoptpy4.delete_SwigPyIterator
75
76 def value(self):
77 r"""value(SwigPyIterator self) -> PyObject *"""
78 return libconoptpy4.SwigPyIterator_value(self)
79
80 def incr(self, n=1):
81 r"""
82 incr(SwigPyIterator self, size_t n=1) -> SwigPyIterator
83
84 Parameters
85 ----------
86 n: size_t
87
88 """
89 return libconoptpy4.SwigPyIterator_incr(self, n)
90
91 def decr(self, n=1):
92 r"""
93 decr(SwigPyIterator self, size_t n=1) -> SwigPyIterator
94
95 Parameters
96 ----------
97 n: size_t
98
99 """
100 return libconoptpy4.SwigPyIterator_decr(self, n)
101
102 def distance(self, x):
103 r"""
104 distance(SwigPyIterator self, SwigPyIterator x) -> ptrdiff_t
105
106 Parameters
107 ----------
108 x: swig::SwigPyIterator const &
109
110 """
111 return libconoptpy4.SwigPyIterator_distance(self, x)
112
113 def equal(self, x):
114 r"""
115 equal(SwigPyIterator self, SwigPyIterator x) -> bool
116
117 Parameters
118 ----------
119 x: swig::SwigPyIterator const &
120
121 """
122 return libconoptpy4.SwigPyIterator_equal(self, x)
123
124 def copy(self):
125 r"""copy(SwigPyIterator self) -> SwigPyIterator"""
126 return libconoptpy4.SwigPyIterator_copy(self)
127
128 def next(self):
129 r"""next(SwigPyIterator self) -> PyObject *"""
130 return libconoptpy4.SwigPyIterator_next(self)
131
132 def __next__(self):
133 r"""__next__(SwigPyIterator self) -> PyObject *"""
134 return libconoptpy4.SwigPyIterator___next__(self)
135
136 def previous(self):
137 r"""previous(SwigPyIterator self) -> PyObject *"""
138 return libconoptpy4.SwigPyIterator_previous(self)
139
140 def advance(self, n):
141 r"""
142 advance(SwigPyIterator self, ptrdiff_t n) -> SwigPyIterator
143
144 Parameters
145 ----------
146 n: ptrdiff_t
147
148 """
149 return libconoptpy4.SwigPyIterator_advance(self, n)
150
151 def __eq__(self, x):
152 r"""
153 __eq__(SwigPyIterator self, SwigPyIterator x) -> bool
154
155 Parameters
156 ----------
157 x: swig::SwigPyIterator const &
158
159 """
160 return libconoptpy4.SwigPyIterator___eq__(self, x)
161
162 def __ne__(self, x):
163 r"""
164 __ne__(SwigPyIterator self, SwigPyIterator x) -> bool
165
166 Parameters
167 ----------
168 x: swig::SwigPyIterator const &
169
170 """
171 return libconoptpy4.SwigPyIterator___ne__(self, x)
172
173 def __iadd__(self, n):
174 r"""
175 __iadd__(SwigPyIterator self, ptrdiff_t n) -> SwigPyIterator
176
177 Parameters
178 ----------
179 n: ptrdiff_t
180
181 """
182 return libconoptpy4.SwigPyIterator___iadd__(self, n)
183
184 def __isub__(self, n):
185 r"""
186 __isub__(SwigPyIterator self, ptrdiff_t n) -> SwigPyIterator
187
188 Parameters
189 ----------
190 n: ptrdiff_t
191
192 """
193 return libconoptpy4.SwigPyIterator___isub__(self, n)
194
195 def __add__(self, n):
196 r"""
197 __add__(SwigPyIterator self, ptrdiff_t n) -> SwigPyIterator
198
199 Parameters
200 ----------
201 n: ptrdiff_t
202
203 """
204 return libconoptpy4.SwigPyIterator___add__(self, n)
205
206 def __sub__(self, *args):
207 r"""
208 __sub__(SwigPyIterator self, ptrdiff_t n) -> SwigPyIterator
209
210 Parameters
211 ----------
212 n: ptrdiff_t
213
214 __sub__(SwigPyIterator self, SwigPyIterator x) -> ptrdiff_t
215
216 Parameters
217 ----------
218 x: swig::SwigPyIterator const &
219
220 """
221 return libconoptpy4.SwigPyIterator___sub__(self, *args)
222 def __iter__(self):
223 return self
224
225# Register SwigPyIterator in libconoptpy4:
226libconoptpy4.SwigPyIterator_swigregister(SwigPyIterator)
227class IntVector(object):
228 r"""Proxy of C++ std::vector< int > class."""
229
230 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
231 __repr__ = _swig_repr
232
233 def iterator(self):
234 r"""iterator(IntVector self) -> SwigPyIterator"""
235 return libconoptpy4.IntVector_iterator(self)
236 def __iter__(self):
237 return self.iterator()
238
239 def __nonzero__(self):
240 r"""__nonzero__(IntVector self) -> bool"""
241 return libconoptpy4.IntVector___nonzero__(self)
242
243 def __bool__(self):
244 r"""__bool__(IntVector self) -> bool"""
245 return libconoptpy4.IntVector___bool__(self)
246
247 def __len__(self):
248 r"""__len__(IntVector self) -> std::vector< int >::size_type"""
249 return libconoptpy4.IntVector___len__(self)
250
251 def __getslice__(self, i, j):
252 r"""
253 __getslice__(IntVector self, std::vector< int >::difference_type i, std::vector< int >::difference_type j) -> IntVector
254
255 Parameters
256 ----------
257 i: std::vector< int >::difference_type
258 j: std::vector< int >::difference_type
259
260 """
261 return libconoptpy4.IntVector___getslice__(self, i, j)
262
263 def __setslice__(self, *args):
264 r"""
265 __setslice__(IntVector self, std::vector< int >::difference_type i, std::vector< int >::difference_type j)
266
267 Parameters
268 ----------
269 i: std::vector< int >::difference_type
270 j: std::vector< int >::difference_type
271
272 __setslice__(IntVector self, std::vector< int >::difference_type i, std::vector< int >::difference_type j, IntVector v)
273
274 Parameters
275 ----------
276 i: std::vector< int >::difference_type
277 j: std::vector< int >::difference_type
278 v: std::vector< int,std::allocator< int > > const &
279
280 """
281 return libconoptpy4.IntVector___setslice__(self, *args)
282
283 def __delslice__(self, i, j):
284 r"""
285 __delslice__(IntVector self, std::vector< int >::difference_type i, std::vector< int >::difference_type j)
286
287 Parameters
288 ----------
289 i: std::vector< int >::difference_type
290 j: std::vector< int >::difference_type
291
292 """
293 return libconoptpy4.IntVector___delslice__(self, i, j)
294
295 def __delitem__(self, *args):
296 r"""
297 __delitem__(IntVector self, std::vector< int >::difference_type i)
298
299 Parameters
300 ----------
301 i: std::vector< int >::difference_type
302
303 __delitem__(IntVector self, SWIGPY_SLICEOBJECT * slice)
304
305 Parameters
306 ----------
307 slice: SWIGPY_SLICEOBJECT *
308
309 """
310 return libconoptpy4.IntVector___delitem__(self, *args)
311
312 def __getitem__(self, *args):
313 r"""
314 __getitem__(IntVector self, SWIGPY_SLICEOBJECT * slice) -> IntVector
315
316 Parameters
317 ----------
318 slice: SWIGPY_SLICEOBJECT *
319
320 __getitem__(IntVector self, std::vector< int >::difference_type i) -> std::vector< int >::value_type const &
321
322 Parameters
323 ----------
324 i: std::vector< int >::difference_type
325
326 """
327 return libconoptpy4.IntVector___getitem__(self, *args)
328
329 def __setitem__(self, *args):
330 r"""
331 __setitem__(IntVector self, SWIGPY_SLICEOBJECT * slice, IntVector v)
332
333 Parameters
334 ----------
335 slice: SWIGPY_SLICEOBJECT *
336 v: std::vector< int,std::allocator< int > > const &
337
338 __setitem__(IntVector self, SWIGPY_SLICEOBJECT * slice)
339
340 Parameters
341 ----------
342 slice: SWIGPY_SLICEOBJECT *
343
344 __setitem__(IntVector self, std::vector< int >::difference_type i, std::vector< int >::value_type const & x)
345
346 Parameters
347 ----------
348 i: std::vector< int >::difference_type
349 x: std::vector< int >::value_type const &
350
351 """
352 return libconoptpy4.IntVector___setitem__(self, *args)
353
354 def pop(self):
355 r"""pop(IntVector self) -> std::vector< int >::value_type"""
356 return libconoptpy4.IntVector_pop(self)
357
358 def append(self, x):
359 r"""
360 append(IntVector self, std::vector< int >::value_type const & x)
361
362 Parameters
363 ----------
364 x: std::vector< int >::value_type const &
365
366 """
367 return libconoptpy4.IntVector_append(self, x)
368
369 def empty(self):
370 r"""empty(IntVector self) -> bool"""
371 return libconoptpy4.IntVector_empty(self)
372
373 def size(self):
374 r"""size(IntVector self) -> std::vector< int >::size_type"""
375 return libconoptpy4.IntVector_size(self)
376
377 def swap(self, v):
378 r"""
379 swap(IntVector self, IntVector v)
380
381 Parameters
382 ----------
383 v: std::vector< int > &
384
385 """
386 return libconoptpy4.IntVector_swap(self, v)
387
388 def begin(self):
389 r"""begin(IntVector self) -> std::vector< int >::iterator"""
390 return libconoptpy4.IntVector_begin(self)
391
392 def end(self):
393 r"""end(IntVector self) -> std::vector< int >::iterator"""
394 return libconoptpy4.IntVector_end(self)
395
396 def rbegin(self):
397 r"""rbegin(IntVector self) -> std::vector< int >::reverse_iterator"""
398 return libconoptpy4.IntVector_rbegin(self)
399
400 def rend(self):
401 r"""rend(IntVector self) -> std::vector< int >::reverse_iterator"""
402 return libconoptpy4.IntVector_rend(self)
403
404 def clear(self):
405 r"""clear(IntVector self)"""
406 return libconoptpy4.IntVector_clear(self)
407
408 def get_allocator(self):
409 r"""get_allocator(IntVector self) -> std::vector< int >::allocator_type"""
410 return libconoptpy4.IntVector_get_allocator(self)
411
412 def pop_back(self):
413 r"""pop_back(IntVector self)"""
414 return libconoptpy4.IntVector_pop_back(self)
415
416 def erase(self, *args):
417 r"""
418 erase(IntVector self, std::vector< int >::iterator pos) -> std::vector< int >::iterator
419
420 Parameters
421 ----------
422 pos: std::vector< int >::iterator
423
424 erase(IntVector self, std::vector< int >::iterator first, std::vector< int >::iterator last) -> std::vector< int >::iterator
425
426 Parameters
427 ----------
428 first: std::vector< int >::iterator
429 last: std::vector< int >::iterator
430
431 """
432 return libconoptpy4.IntVector_erase(self, *args)
433
434 def __init__(self, *args):
435 r"""
436 __init__(IntVector self) -> IntVector
437 __init__(IntVector self, IntVector other) -> IntVector
438
439 Parameters
440 ----------
441 other: std::vector< int > const &
442
443 __init__(IntVector self, std::vector< int >::size_type size) -> IntVector
444
445 Parameters
446 ----------
447 size: std::vector< int >::size_type
448
449 __init__(IntVector self, std::vector< int >::size_type size, std::vector< int >::value_type const & value) -> IntVector
450
451 Parameters
452 ----------
453 size: std::vector< int >::size_type
454 value: std::vector< int >::value_type const &
455
456 """
457 libconoptpy4.IntVector_swiginit(self, libconoptpy4.new_IntVector(*args))
458
459 def push_back(self, x):
460 r"""
461 push_back(IntVector self, std::vector< int >::value_type const & x)
462
463 Parameters
464 ----------
465 x: std::vector< int >::value_type const &
466
467 """
468 return libconoptpy4.IntVector_push_back(self, x)
469
470 def front(self):
471 r"""front(IntVector self) -> std::vector< int >::value_type const &"""
472 return libconoptpy4.IntVector_front(self)
473
474 def back(self):
475 r"""back(IntVector self) -> std::vector< int >::value_type const &"""
476 return libconoptpy4.IntVector_back(self)
477
478 def assign(self, n, x):
479 r"""
480 assign(IntVector self, std::vector< int >::size_type n, std::vector< int >::value_type const & x)
481
482 Parameters
483 ----------
484 n: std::vector< int >::size_type
485 x: std::vector< int >::value_type const &
486
487 """
488 return libconoptpy4.IntVector_assign(self, n, x)
489
490 def resize(self, *args):
491 r"""
492 resize(IntVector self, std::vector< int >::size_type new_size)
493
494 Parameters
495 ----------
496 new_size: std::vector< int >::size_type
497
498 resize(IntVector self, std::vector< int >::size_type new_size, std::vector< int >::value_type const & x)
499
500 Parameters
501 ----------
502 new_size: std::vector< int >::size_type
503 x: std::vector< int >::value_type const &
504
505 """
506 return libconoptpy4.IntVector_resize(self, *args)
507
508 def insert(self, *args):
509 r"""
510 insert(IntVector self, std::vector< int >::iterator pos, std::vector< int >::value_type const & x) -> std::vector< int >::iterator
511
512 Parameters
513 ----------
514 pos: std::vector< int >::iterator
515 x: std::vector< int >::value_type const &
516
517 insert(IntVector self, std::vector< int >::iterator pos, std::vector< int >::size_type n, std::vector< int >::value_type const & x)
518
519 Parameters
520 ----------
521 pos: std::vector< int >::iterator
522 n: std::vector< int >::size_type
523 x: std::vector< int >::value_type const &
524
525 """
526 return libconoptpy4.IntVector_insert(self, *args)
527
528 def reserve(self, n):
529 r"""
530 reserve(IntVector self, std::vector< int >::size_type n)
531
532 Parameters
533 ----------
534 n: std::vector< int >::size_type
535
536 """
537 return libconoptpy4.IntVector_reserve(self, n)
538
539 def capacity(self):
540 r"""capacity(IntVector self) -> std::vector< int >::size_type"""
541 return libconoptpy4.IntVector_capacity(self)
542 __swig_destroy__ = libconoptpy4.delete_IntVector
543
544# Register IntVector in libconoptpy4:
545libconoptpy4.IntVector_swigregister(IntVector)
546class DoubleVector(object):
547 r"""Proxy of C++ std::vector< double > class."""
548
549 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
550 __repr__ = _swig_repr
551
552 def iterator(self):
553 r"""iterator(DoubleVector self) -> SwigPyIterator"""
554 return libconoptpy4.DoubleVector_iterator(self)
555 def __iter__(self):
556 return self.iterator()
557
558 def __nonzero__(self):
559 r"""__nonzero__(DoubleVector self) -> bool"""
560 return libconoptpy4.DoubleVector___nonzero__(self)
561
562 def __bool__(self):
563 r"""__bool__(DoubleVector self) -> bool"""
564 return libconoptpy4.DoubleVector___bool__(self)
565
566 def __len__(self):
567 r"""__len__(DoubleVector self) -> std::vector< double >::size_type"""
568 return libconoptpy4.DoubleVector___len__(self)
569
570 def __getslice__(self, i, j):
571 r"""
572 __getslice__(DoubleVector self, std::vector< double >::difference_type i, std::vector< double >::difference_type j) -> DoubleVector
573
574 Parameters
575 ----------
576 i: std::vector< double >::difference_type
577 j: std::vector< double >::difference_type
578
579 """
580 return libconoptpy4.DoubleVector___getslice__(self, i, j)
581
582 def __setslice__(self, *args):
583 r"""
584 __setslice__(DoubleVector self, std::vector< double >::difference_type i, std::vector< double >::difference_type j)
585
586 Parameters
587 ----------
588 i: std::vector< double >::difference_type
589 j: std::vector< double >::difference_type
590
591 __setslice__(DoubleVector self, std::vector< double >::difference_type i, std::vector< double >::difference_type j, DoubleVector v)
592
593 Parameters
594 ----------
595 i: std::vector< double >::difference_type
596 j: std::vector< double >::difference_type
597 v: std::vector< double,std::allocator< double > > const &
598
599 """
600 return libconoptpy4.DoubleVector___setslice__(self, *args)
601
602 def __delslice__(self, i, j):
603 r"""
604 __delslice__(DoubleVector self, std::vector< double >::difference_type i, std::vector< double >::difference_type j)
605
606 Parameters
607 ----------
608 i: std::vector< double >::difference_type
609 j: std::vector< double >::difference_type
610
611 """
612 return libconoptpy4.DoubleVector___delslice__(self, i, j)
613
614 def __delitem__(self, *args):
615 r"""
616 __delitem__(DoubleVector self, std::vector< double >::difference_type i)
617
618 Parameters
619 ----------
620 i: std::vector< double >::difference_type
621
622 __delitem__(DoubleVector self, SWIGPY_SLICEOBJECT * slice)
623
624 Parameters
625 ----------
626 slice: SWIGPY_SLICEOBJECT *
627
628 """
629 return libconoptpy4.DoubleVector___delitem__(self, *args)
630
631 def __getitem__(self, *args):
632 r"""
633 __getitem__(DoubleVector self, SWIGPY_SLICEOBJECT * slice) -> DoubleVector
634
635 Parameters
636 ----------
637 slice: SWIGPY_SLICEOBJECT *
638
639 __getitem__(DoubleVector self, std::vector< double >::difference_type i) -> std::vector< double >::value_type const &
640
641 Parameters
642 ----------
643 i: std::vector< double >::difference_type
644
645 """
646 return libconoptpy4.DoubleVector___getitem__(self, *args)
647
648 def __setitem__(self, *args):
649 r"""
650 __setitem__(DoubleVector self, SWIGPY_SLICEOBJECT * slice, DoubleVector v)
651
652 Parameters
653 ----------
654 slice: SWIGPY_SLICEOBJECT *
655 v: std::vector< double,std::allocator< double > > const &
656
657 __setitem__(DoubleVector self, SWIGPY_SLICEOBJECT * slice)
658
659 Parameters
660 ----------
661 slice: SWIGPY_SLICEOBJECT *
662
663 __setitem__(DoubleVector self, std::vector< double >::difference_type i, std::vector< double >::value_type const & x)
664
665 Parameters
666 ----------
667 i: std::vector< double >::difference_type
668 x: std::vector< double >::value_type const &
669
670 """
671 return libconoptpy4.DoubleVector___setitem__(self, *args)
672
673 def pop(self):
674 r"""pop(DoubleVector self) -> std::vector< double >::value_type"""
675 return libconoptpy4.DoubleVector_pop(self)
676
677 def append(self, x):
678 r"""
679 append(DoubleVector self, std::vector< double >::value_type const & x)
680
681 Parameters
682 ----------
683 x: std::vector< double >::value_type const &
684
685 """
686 return libconoptpy4.DoubleVector_append(self, x)
687
688 def empty(self):
689 r"""empty(DoubleVector self) -> bool"""
690 return libconoptpy4.DoubleVector_empty(self)
691
692 def size(self):
693 r"""size(DoubleVector self) -> std::vector< double >::size_type"""
694 return libconoptpy4.DoubleVector_size(self)
695
696 def swap(self, v):
697 r"""
698 swap(DoubleVector self, DoubleVector v)
699
700 Parameters
701 ----------
702 v: std::vector< double > &
703
704 """
705 return libconoptpy4.DoubleVector_swap(self, v)
706
707 def begin(self):
708 r"""begin(DoubleVector self) -> std::vector< double >::iterator"""
709 return libconoptpy4.DoubleVector_begin(self)
710
711 def end(self):
712 r"""end(DoubleVector self) -> std::vector< double >::iterator"""
713 return libconoptpy4.DoubleVector_end(self)
714
715 def rbegin(self):
716 r"""rbegin(DoubleVector self) -> std::vector< double >::reverse_iterator"""
717 return libconoptpy4.DoubleVector_rbegin(self)
718
719 def rend(self):
720 r"""rend(DoubleVector self) -> std::vector< double >::reverse_iterator"""
721 return libconoptpy4.DoubleVector_rend(self)
722
723 def clear(self):
724 r"""clear(DoubleVector self)"""
725 return libconoptpy4.DoubleVector_clear(self)
726
727 def get_allocator(self):
728 r"""get_allocator(DoubleVector self) -> std::vector< double >::allocator_type"""
729 return libconoptpy4.DoubleVector_get_allocator(self)
730
731 def pop_back(self):
732 r"""pop_back(DoubleVector self)"""
733 return libconoptpy4.DoubleVector_pop_back(self)
734
735 def erase(self, *args):
736 r"""
737 erase(DoubleVector self, std::vector< double >::iterator pos) -> std::vector< double >::iterator
738
739 Parameters
740 ----------
741 pos: std::vector< double >::iterator
742
743 erase(DoubleVector self, std::vector< double >::iterator first, std::vector< double >::iterator last) -> std::vector< double >::iterator
744
745 Parameters
746 ----------
747 first: std::vector< double >::iterator
748 last: std::vector< double >::iterator
749
750 """
751 return libconoptpy4.DoubleVector_erase(self, *args)
752
753 def __init__(self, *args):
754 r"""
755 __init__(DoubleVector self) -> DoubleVector
756 __init__(DoubleVector self, DoubleVector other) -> DoubleVector
757
758 Parameters
759 ----------
760 other: std::vector< double > const &
761
762 __init__(DoubleVector self, std::vector< double >::size_type size) -> DoubleVector
763
764 Parameters
765 ----------
766 size: std::vector< double >::size_type
767
768 __init__(DoubleVector self, std::vector< double >::size_type size, std::vector< double >::value_type const & value) -> DoubleVector
769
770 Parameters
771 ----------
772 size: std::vector< double >::size_type
773 value: std::vector< double >::value_type const &
774
775 """
776 libconoptpy4.DoubleVector_swiginit(self, libconoptpy4.new_DoubleVector(*args))
777
778 def push_back(self, x):
779 r"""
780 push_back(DoubleVector self, std::vector< double >::value_type const & x)
781
782 Parameters
783 ----------
784 x: std::vector< double >::value_type const &
785
786 """
787 return libconoptpy4.DoubleVector_push_back(self, x)
788
789 def front(self):
790 r"""front(DoubleVector self) -> std::vector< double >::value_type const &"""
791 return libconoptpy4.DoubleVector_front(self)
792
793 def back(self):
794 r"""back(DoubleVector self) -> std::vector< double >::value_type const &"""
795 return libconoptpy4.DoubleVector_back(self)
796
797 def assign(self, n, x):
798 r"""
799 assign(DoubleVector self, std::vector< double >::size_type n, std::vector< double >::value_type const & x)
800
801 Parameters
802 ----------
803 n: std::vector< double >::size_type
804 x: std::vector< double >::value_type const &
805
806 """
807 return libconoptpy4.DoubleVector_assign(self, n, x)
808
809 def resize(self, *args):
810 r"""
811 resize(DoubleVector self, std::vector< double >::size_type new_size)
812
813 Parameters
814 ----------
815 new_size: std::vector< double >::size_type
816
817 resize(DoubleVector self, std::vector< double >::size_type new_size, std::vector< double >::value_type const & x)
818
819 Parameters
820 ----------
821 new_size: std::vector< double >::size_type
822 x: std::vector< double >::value_type const &
823
824 """
825 return libconoptpy4.DoubleVector_resize(self, *args)
826
827 def insert(self, *args):
828 r"""
829 insert(DoubleVector self, std::vector< double >::iterator pos, std::vector< double >::value_type const & x) -> std::vector< double >::iterator
830
831 Parameters
832 ----------
833 pos: std::vector< double >::iterator
834 x: std::vector< double >::value_type const &
835
836 insert(DoubleVector self, std::vector< double >::iterator pos, std::vector< double >::size_type n, std::vector< double >::value_type const & x)
837
838 Parameters
839 ----------
840 pos: std::vector< double >::iterator
841 n: std::vector< double >::size_type
842 x: std::vector< double >::value_type const &
843
844 """
845 return libconoptpy4.DoubleVector_insert(self, *args)
846
847 def reserve(self, n):
848 r"""
849 reserve(DoubleVector self, std::vector< double >::size_type n)
850
851 Parameters
852 ----------
853 n: std::vector< double >::size_type
854
855 """
856 return libconoptpy4.DoubleVector_reserve(self, n)
857
858 def capacity(self):
859 r"""capacity(DoubleVector self) -> std::vector< double >::size_type"""
860 return libconoptpy4.DoubleVector_capacity(self)
861 __swig_destroy__ = libconoptpy4.delete_DoubleVector
862
863# Register DoubleVector in libconoptpy4:
864libconoptpy4.DoubleVector_swigregister(DoubleVector)
865class StringVector(object):
866 r"""Proxy of C++ std::vector< std::string > class."""
867
868 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
869 __repr__ = _swig_repr
870
871 def iterator(self):
872 r"""iterator(StringVector self) -> SwigPyIterator"""
873 return libconoptpy4.StringVector_iterator(self)
874 def __iter__(self):
875 return self.iterator()
876
877 def __nonzero__(self):
878 r"""__nonzero__(StringVector self) -> bool"""
879 return libconoptpy4.StringVector___nonzero__(self)
880
881 def __bool__(self):
882 r"""__bool__(StringVector self) -> bool"""
883 return libconoptpy4.StringVector___bool__(self)
884
885 def __len__(self):
886 r"""__len__(StringVector self) -> std::vector< std::string >::size_type"""
887 return libconoptpy4.StringVector___len__(self)
888
889 def __getslice__(self, i, j):
890 r"""
891 __getslice__(StringVector self, std::vector< std::string >::difference_type i, std::vector< std::string >::difference_type j) -> StringVector
892
893 Parameters
894 ----------
895 i: std::vector< std::string >::difference_type
896 j: std::vector< std::string >::difference_type
897
898 """
899 return libconoptpy4.StringVector___getslice__(self, i, j)
900
901 def __setslice__(self, *args):
902 r"""
903 __setslice__(StringVector self, std::vector< std::string >::difference_type i, std::vector< std::string >::difference_type j)
904
905 Parameters
906 ----------
907 i: std::vector< std::string >::difference_type
908 j: std::vector< std::string >::difference_type
909
910 __setslice__(StringVector self, std::vector< std::string >::difference_type i, std::vector< std::string >::difference_type j, StringVector v)
911
912 Parameters
913 ----------
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 &
917
918 """
919 return libconoptpy4.StringVector___setslice__(self, *args)
920
921 def __delslice__(self, i, j):
922 r"""
923 __delslice__(StringVector self, std::vector< std::string >::difference_type i, std::vector< std::string >::difference_type j)
924
925 Parameters
926 ----------
927 i: std::vector< std::string >::difference_type
928 j: std::vector< std::string >::difference_type
929
930 """
931 return libconoptpy4.StringVector___delslice__(self, i, j)
932
933 def __delitem__(self, *args):
934 r"""
935 __delitem__(StringVector self, std::vector< std::string >::difference_type i)
936
937 Parameters
938 ----------
939 i: std::vector< std::string >::difference_type
940
941 __delitem__(StringVector self, SWIGPY_SLICEOBJECT * slice)
942
943 Parameters
944 ----------
945 slice: SWIGPY_SLICEOBJECT *
946
947 """
948 return libconoptpy4.StringVector___delitem__(self, *args)
949
950 def __getitem__(self, *args):
951 r"""
952 __getitem__(StringVector self, SWIGPY_SLICEOBJECT * slice) -> StringVector
953
954 Parameters
955 ----------
956 slice: SWIGPY_SLICEOBJECT *
957
958 __getitem__(StringVector self, std::vector< std::string >::difference_type i) -> std::vector< std::string >::value_type const &
959
960 Parameters
961 ----------
962 i: std::vector< std::string >::difference_type
963
964 """
965 return libconoptpy4.StringVector___getitem__(self, *args)
966
967 def __setitem__(self, *args):
968 r"""
969 __setitem__(StringVector self, SWIGPY_SLICEOBJECT * slice, StringVector v)
970
971 Parameters
972 ----------
973 slice: SWIGPY_SLICEOBJECT *
974 v: std::vector< std::string,std::allocator< std::string > > const &
975
976 __setitem__(StringVector self, SWIGPY_SLICEOBJECT * slice)
977
978 Parameters
979 ----------
980 slice: SWIGPY_SLICEOBJECT *
981
982 __setitem__(StringVector self, std::vector< std::string >::difference_type i, std::vector< std::string >::value_type const & x)
983
984 Parameters
985 ----------
986 i: std::vector< std::string >::difference_type
987 x: std::vector< std::string >::value_type const &
988
989 """
990 return libconoptpy4.StringVector___setitem__(self, *args)
991
992 def pop(self):
993 r"""pop(StringVector self) -> std::vector< std::string >::value_type"""
994 return libconoptpy4.StringVector_pop(self)
995
996 def append(self, x):
997 r"""
998 append(StringVector self, std::vector< std::string >::value_type const & x)
999
1000 Parameters
1001 ----------
1002 x: std::vector< std::string >::value_type const &
1003
1004 """
1005 return libconoptpy4.StringVector_append(self, x)
1006
1007 def empty(self):
1008 r"""empty(StringVector self) -> bool"""
1009 return libconoptpy4.StringVector_empty(self)
1010
1011 def size(self):
1012 r"""size(StringVector self) -> std::vector< std::string >::size_type"""
1013 return libconoptpy4.StringVector_size(self)
1014
1015 def swap(self, v):
1016 r"""
1017 swap(StringVector self, StringVector v)
1018
1019 Parameters
1020 ----------
1021 v: std::vector< std::string > &
1022
1023 """
1024 return libconoptpy4.StringVector_swap(self, v)
1025
1026 def begin(self):
1027 r"""begin(StringVector self) -> std::vector< std::string >::iterator"""
1028 return libconoptpy4.StringVector_begin(self)
1029
1030 def end(self):
1031 r"""end(StringVector self) -> std::vector< std::string >::iterator"""
1032 return libconoptpy4.StringVector_end(self)
1033
1034 def rbegin(self):
1035 r"""rbegin(StringVector self) -> std::vector< std::string >::reverse_iterator"""
1036 return libconoptpy4.StringVector_rbegin(self)
1037
1038 def rend(self):
1039 r"""rend(StringVector self) -> std::vector< std::string >::reverse_iterator"""
1040 return libconoptpy4.StringVector_rend(self)
1041
1042 def clear(self):
1043 r"""clear(StringVector self)"""
1044 return libconoptpy4.StringVector_clear(self)
1045
1046 def get_allocator(self):
1047 r"""get_allocator(StringVector self) -> std::vector< std::string >::allocator_type"""
1048 return libconoptpy4.StringVector_get_allocator(self)
1049
1050 def pop_back(self):
1051 r"""pop_back(StringVector self)"""
1052 return libconoptpy4.StringVector_pop_back(self)
1053
1054 def erase(self, *args):
1055 r"""
1056 erase(StringVector self, std::vector< std::string >::iterator pos) -> std::vector< std::string >::iterator
1057
1058 Parameters
1059 ----------
1060 pos: std::vector< std::string >::iterator
1061
1062 erase(StringVector self, std::vector< std::string >::iterator first, std::vector< std::string >::iterator last) -> std::vector< std::string >::iterator
1063
1064 Parameters
1065 ----------
1066 first: std::vector< std::string >::iterator
1067 last: std::vector< std::string >::iterator
1068
1069 """
1070 return libconoptpy4.StringVector_erase(self, *args)
1071
1072 def __init__(self, *args):
1073 r"""
1074 __init__(StringVector self) -> StringVector
1075 __init__(StringVector self, StringVector other) -> StringVector
1076
1077 Parameters
1078 ----------
1079 other: std::vector< std::string > const &
1080
1081 __init__(StringVector self, std::vector< std::string >::size_type size) -> StringVector
1082
1083 Parameters
1084 ----------
1085 size: std::vector< std::string >::size_type
1086
1087 __init__(StringVector self, std::vector< std::string >::size_type size, std::vector< std::string >::value_type const & value) -> StringVector
1088
1089 Parameters
1090 ----------
1091 size: std::vector< std::string >::size_type
1092 value: std::vector< std::string >::value_type const &
1093
1094 """
1095 libconoptpy4.StringVector_swiginit(self, libconoptpy4.new_StringVector(*args))
1096
1097 def push_back(self, x):
1098 r"""
1099 push_back(StringVector self, std::vector< std::string >::value_type const & x)
1100
1101 Parameters
1102 ----------
1103 x: std::vector< std::string >::value_type const &
1104
1105 """
1106 return libconoptpy4.StringVector_push_back(self, x)
1107
1108 def front(self):
1109 r"""front(StringVector self) -> std::vector< std::string >::value_type const &"""
1110 return libconoptpy4.StringVector_front(self)
1111
1112 def back(self):
1113 r"""back(StringVector self) -> std::vector< std::string >::value_type const &"""
1114 return libconoptpy4.StringVector_back(self)
1115
1116 def assign(self, n, x):
1117 r"""
1118 assign(StringVector self, std::vector< std::string >::size_type n, std::vector< std::string >::value_type const & x)
1119
1120 Parameters
1121 ----------
1122 n: std::vector< std::string >::size_type
1123 x: std::vector< std::string >::value_type const &
1124
1125 """
1126 return libconoptpy4.StringVector_assign(self, n, x)
1127
1128 def resize(self, *args):
1129 r"""
1130 resize(StringVector self, std::vector< std::string >::size_type new_size)
1131
1132 Parameters
1133 ----------
1134 new_size: std::vector< std::string >::size_type
1135
1136 resize(StringVector self, std::vector< std::string >::size_type new_size, std::vector< std::string >::value_type const & x)
1137
1138 Parameters
1139 ----------
1140 new_size: std::vector< std::string >::size_type
1141 x: std::vector< std::string >::value_type const &
1142
1143 """
1144 return libconoptpy4.StringVector_resize(self, *args)
1145
1146 def insert(self, *args):
1147 r"""
1148 insert(StringVector self, std::vector< std::string >::iterator pos, std::vector< std::string >::value_type const & x) -> std::vector< std::string >::iterator
1149
1150 Parameters
1151 ----------
1152 pos: std::vector< std::string >::iterator
1153 x: std::vector< std::string >::value_type const &
1154
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)
1156
1157 Parameters
1158 ----------
1159 pos: std::vector< std::string >::iterator
1160 n: std::vector< std::string >::size_type
1161 x: std::vector< std::string >::value_type const &
1162
1163 """
1164 return libconoptpy4.StringVector_insert(self, *args)
1165
1166 def reserve(self, n):
1167 r"""
1168 reserve(StringVector self, std::vector< std::string >::size_type n)
1169
1170 Parameters
1171 ----------
1172 n: std::vector< std::string >::size_type
1173
1174 """
1175 return libconoptpy4.StringVector_reserve(self, n)
1176
1177 def capacity(self):
1178 r"""capacity(StringVector self) -> std::vector< std::string >::size_type"""
1179 return libconoptpy4.StringVector_capacity(self)
1180 __swig_destroy__ = libconoptpy4.delete_StringVector
1181
1182# Register StringVector in libconoptpy4:
1183libconoptpy4.StringVector_swigregister(StringVector)
1184class IntArray3(object):
1185 r"""Proxy of C++ std::array< int,3 > class."""
1186
1187 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
1188 __repr__ = _swig_repr
1189
1190 def iterator(self):
1191 r"""iterator(IntArray3 self) -> SwigPyIterator"""
1192 return libconoptpy4.IntArray3_iterator(self)
1193 def __iter__(self):
1194 return self.iterator()
1195
1196 def __nonzero__(self):
1197 r"""__nonzero__(IntArray3 self) -> bool"""
1198 return libconoptpy4.IntArray3___nonzero__(self)
1199
1200 def __bool__(self):
1201 r"""__bool__(IntArray3 self) -> bool"""
1202 return libconoptpy4.IntArray3___bool__(self)
1203
1204 def __len__(self):
1205 r"""__len__(IntArray3 self) -> std::array< int,3 >::size_type"""
1206 return libconoptpy4.IntArray3___len__(self)
1207
1208 def __getslice__(self, i, j):
1209 r"""
1210 __getslice__(IntArray3 self, std::array< int,3 >::difference_type i, std::array< int,3 >::difference_type j) -> IntArray3
1211
1212 Parameters
1213 ----------
1214 i: std::array< int,3 >::difference_type
1215 j: std::array< int,3 >::difference_type
1216
1217 """
1218 return libconoptpy4.IntArray3___getslice__(self, i, j)
1219
1220 def __setslice__(self, *args):
1221 r"""
1222 __setslice__(IntArray3 self, std::array< int,3 >::difference_type i, std::array< int,3 >::difference_type j)
1223
1224 Parameters
1225 ----------
1226 i: std::array< int,3 >::difference_type
1227 j: std::array< int,3 >::difference_type
1228
1229 __setslice__(IntArray3 self, std::array< int,3 >::difference_type i, std::array< int,3 >::difference_type j, IntArray3 v)
1230
1231 Parameters
1232 ----------
1233 i: std::array< int,3 >::difference_type
1234 j: std::array< int,3 >::difference_type
1235 v: std::array< int,3 > const &
1236
1237 """
1238 return libconoptpy4.IntArray3___setslice__(self, *args)
1239
1240 def __delslice__(self, i, j):
1241 r"""
1242 __delslice__(IntArray3 self, std::array< int,3 >::difference_type i, std::array< int,3 >::difference_type j)
1243
1244 Parameters
1245 ----------
1246 i: std::array< int,3 >::difference_type
1247 j: std::array< int,3 >::difference_type
1248
1249 """
1250 return libconoptpy4.IntArray3___delslice__(self, i, j)
1251
1252 def __delitem__(self, *args):
1253 r"""
1254 __delitem__(IntArray3 self, std::array< int,3 >::difference_type i)
1255
1256 Parameters
1257 ----------
1258 i: std::array< int,3 >::difference_type
1259
1260 __delitem__(IntArray3 self, SWIGPY_SLICEOBJECT * slice)
1261
1262 Parameters
1263 ----------
1264 slice: SWIGPY_SLICEOBJECT *
1265
1266 """
1267 return libconoptpy4.IntArray3___delitem__(self, *args)
1268
1269 def __getitem__(self, *args):
1270 r"""
1271 __getitem__(IntArray3 self, SWIGPY_SLICEOBJECT * slice) -> IntArray3
1272
1273 Parameters
1274 ----------
1275 slice: SWIGPY_SLICEOBJECT *
1276
1277 __getitem__(IntArray3 self, std::array< int,3 >::difference_type i) -> std::array< int,3 >::value_type const &
1278
1279 Parameters
1280 ----------
1281 i: std::array< int,3 >::difference_type
1282
1283 """
1284 return libconoptpy4.IntArray3___getitem__(self, *args)
1285
1286 def __setitem__(self, *args):
1287 r"""
1288 __setitem__(IntArray3 self, SWIGPY_SLICEOBJECT * slice, IntArray3 v)
1289
1290 Parameters
1291 ----------
1292 slice: SWIGPY_SLICEOBJECT *
1293 v: std::array< int,3 > const &
1294
1295 __setitem__(IntArray3 self, SWIGPY_SLICEOBJECT * slice)
1296
1297 Parameters
1298 ----------
1299 slice: SWIGPY_SLICEOBJECT *
1300
1301 __setitem__(IntArray3 self, std::array< int,3 >::difference_type i, std::array< int,3 >::value_type const & x)
1302
1303 Parameters
1304 ----------
1305 i: std::array< int,3 >::difference_type
1306 x: std::array< int,3 >::value_type const &
1307
1308 """
1309 return libconoptpy4.IntArray3___setitem__(self, *args)
1310
1311 def __init__(self, *args):
1312 r"""
1313 __init__(IntArray3 self) -> IntArray3
1314 __init__(IntArray3 self, IntArray3 other) -> IntArray3
1315
1316 Parameters
1317 ----------
1318 other: std::array< int,3 > const &
1319
1320 """
1321 libconoptpy4.IntArray3_swiginit(self, libconoptpy4.new_IntArray3(*args))
1322
1323 def empty(self):
1324 r"""empty(IntArray3 self) -> bool"""
1325 return libconoptpy4.IntArray3_empty(self)
1326
1327 def size(self):
1328 r"""size(IntArray3 self) -> std::array< int,3 >::size_type"""
1329 return libconoptpy4.IntArray3_size(self)
1330
1331 def swap(self, v):
1332 r"""
1333 swap(IntArray3 self, IntArray3 v)
1334
1335 Parameters
1336 ----------
1337 v: std::array< int,3 > &
1338
1339 """
1340 return libconoptpy4.IntArray3_swap(self, v)
1341
1342 def begin(self):
1343 r"""begin(IntArray3 self) -> std::array< int,3 >::iterator"""
1344 return libconoptpy4.IntArray3_begin(self)
1345
1346 def end(self):
1347 r"""end(IntArray3 self) -> std::array< int,3 >::iterator"""
1348 return libconoptpy4.IntArray3_end(self)
1349
1350 def rbegin(self):
1351 r"""rbegin(IntArray3 self) -> std::array< int,3 >::reverse_iterator"""
1352 return libconoptpy4.IntArray3_rbegin(self)
1353
1354 def rend(self):
1355 r"""rend(IntArray3 self) -> std::array< int,3 >::reverse_iterator"""
1356 return libconoptpy4.IntArray3_rend(self)
1357
1358 def front(self):
1359 r"""front(IntArray3 self) -> std::array< int,3 >::value_type const &"""
1360 return libconoptpy4.IntArray3_front(self)
1361
1362 def back(self):
1363 r"""back(IntArray3 self) -> std::array< int,3 >::value_type const &"""
1364 return libconoptpy4.IntArray3_back(self)
1365
1366 def fill(self, u):
1367 r"""
1368 fill(IntArray3 self, std::array< int,3 >::value_type const & u)
1369
1370 Parameters
1371 ----------
1372 u: std::array< int,3 >::value_type const &
1373
1374 """
1375 return libconoptpy4.IntArray3_fill(self, u)
1376 __swig_destroy__ = libconoptpy4.delete_IntArray3
1377
1378# Register IntArray3 in libconoptpy4:
1379libconoptpy4.IntArray3_swigregister(IntArray3)
1380class Conopt(object):
1381 r"""
1382 The Conopt class
1383
1384 @ingroup CONOPT_PYTHON
1385 """
1386
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"""
1391
1392 def __init__(self, *args):
1393 r"""
1394 Constructor
1395
1396 @param modelName: the name for the model.
1397
1398 """
1399 libconoptpy4.Conopt_swiginit(self, libconoptpy4.new_Conopt(*args))
1400 __swig_destroy__ = libconoptpy4.delete_Conopt
1401
1402 def solve(self):
1403 r"""
1404 @copydoc DEF_COI_SOLVE
1405
1406
1407 @ingroup UTILITY_ROUTINES_PYTHON
1408 """
1409 return libconoptpy4.Conopt_solve(self)
1410
1411 def checkModelAndParameters(self):
1412 r""" checks the model data and parameters to ensure it is setup correctly"""
1413 return libconoptpy4.Conopt_checkModelAndParameters(self)
1414
1415 def controlVector(self):
1416 r"""
1417 returns the control vector pointer.
1418
1419 This is for use in the C-interface methods
1420
1421
1422 @ingroup UTILITY_ROUTINES_PYTHON
1423 """
1424 return libconoptpy4.Conopt_controlVector(self)
1425
1426 def printStatus(self):
1427 r"""
1428 prints the status of the optimisation
1429
1430
1431 @ingroup UTILITY_ROUTINES_PYTHON
1432 """
1433 return libconoptpy4.Conopt_printStatus(self)
1434
1435 def getName(self):
1436 r"""
1437 returns the model name
1438
1439
1440 @ingroup UTILITY_ROUTINES_PYTHON
1441 """
1442 return libconoptpy4.Conopt_getName(self)
1443
1444 def loadModel(self, modeldata):
1445 r"""
1446 loads the model and stores the pointer in the interface
1447
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.
1450
1451 @param modeldata: a user defined ConoptModelData object
1452
1453
1454 @ingroup CONOPTPYTHON_MODELDATA
1455 """
1456 return libconoptpy4.Conopt_loadModel(self, modeldata)
1457
1458 def modelStatus(self):
1459 r"""
1460 returns the model status
1461
1462 """
1463 return libconoptpy4.Conopt_modelStatus(self)
1464
1465 def solutionStatus(self):
1466 r"""
1467 return the solution status
1468
1469
1470 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1471 """
1472 return libconoptpy4.Conopt_solutionStatus(self)
1473
1474 def iterations(self):
1475 r"""
1476 returns the number of iterations
1477
1478
1479 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1480 """
1481 return libconoptpy4.Conopt_iterations(self)
1482
1483 def objectiveValue(self):
1484 r"""
1485 returns the objective value
1486
1487
1488 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1489 """
1490 return libconoptpy4.Conopt_objectiveValue(self)
1491
1492 def getVariableValues(self):
1493 r"""
1494 returns the variable values
1495
1496
1497 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1498 """
1499 return libconoptpy4.Conopt_getVariableValues(self)
1500
1501 def getVariableMarginals(self):
1502 r"""
1503 returns the variable marginals
1504
1505
1506 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1507 """
1508 return libconoptpy4.Conopt_getVariableMarginals(self)
1509
1510 def getVariableBasisStatus(self):
1511 r"""
1512 returns the variable basis status
1513
1514
1515 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1516 """
1517 return libconoptpy4.Conopt_getVariableBasisStatus(self)
1518
1519 def getVariableStatus(self):
1520 r"""
1521 returns the variable status
1522
1523
1524 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1525 """
1526 return libconoptpy4.Conopt_getVariableStatus(self)
1527
1528 def getConstraintValues(self):
1529 r"""
1530 returns the constraint values
1531
1532
1533 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1534 """
1535 return libconoptpy4.Conopt_getConstraintValues(self)
1536
1537 def getConstraintMarginals(self):
1538 r"""
1539 returns the constraint marginals
1540
1541
1542 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1543 """
1544 return libconoptpy4.Conopt_getConstraintMarginals(self)
1545
1546 def getConstraintBasisStatus(self):
1547 r"""
1548 returns the constraint basis status
1549
1550
1551 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1552 """
1553 return libconoptpy4.Conopt_getConstraintBasisStatus(self)
1554
1555 def getConstraintStatus(self):
1556 r"""
1557 returns the constraint status
1558
1559
1560 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1561 """
1562 return libconoptpy4.Conopt_getConstraintStatus(self)
1563
1564 def setMessageHandler(self, msghandler):
1565 r"""
1566 sets the message handler to the user supplied handler.
1567
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.
1570
1571 @param msghandler: a user defined ConoptMessageHandler object
1572
1573
1574 @ingroup CONOPTPYTHON_MESSAGEHANDLER
1575 """
1576 return libconoptpy4.Conopt_setMessageHandler(self, msghandler)
1577
1578 def sendMessage(self, msg):
1579 r"""
1580 sends a message to the message handler
1581
1582 @param msg: A string for the message that will be processed in the message handler
1583
1584
1585 @ingroup CONOPTPYTHON_MESSAGEHANDLER
1586 """
1587 return libconoptpy4.Conopt_sendMessage(self, msg)
1588
1589 def setVerbosityLevel(self, verblevel):
1590 r"""
1591 sets the verbosity level for messaging
1592
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
1598
1599 @param verblevel: the verbosity level for the message handler
1600
1601
1602 @ingroup CONOPTPYTHON_MESSAGEHANDLER
1603 """
1604 return libconoptpy4.Conopt_setVerbosityLevel(self, verblevel)
1605
1606 @staticmethod
1607 def version():
1608 r"""
1609 returns the version number.
1610
1611 It can be used to ensure that the modeler is linked to the correct version of the CONOPT DLL.
1612
1613
1614 @ingroup UTILITY_ROUTINES_PYTHON
1615 """
1616 return libconoptpy4.Conopt_version()
1617
1618 def debugFV(self, debugfv):
1619 r"""
1620 @copydoc DEF_COI_DEBUGFV
1621
1622
1623 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1624 """
1625 return libconoptpy4.Conopt_debugFV(self, debugfv)
1626
1627 def squareModel(self, square):
1628 r"""
1629 @copydoc DEF_COI_SQUARE
1630
1631
1632 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1633 """
1634 return libconoptpy4.Conopt_squareModel(self, square)
1635
1636 def setLicense(self, licint1, licint2, licint3, licstring):
1637 r"""
1638 @copydoc DEF_COI_LICENSE
1639
1640
1641 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1642 """
1643 return libconoptpy4.Conopt_setLicense(self, licint1, licint2, licint3, licstring)
1644
1645 def setItLim(self, itlim):
1646 r"""
1647 @copydoc DEF_COI_ITLIM
1648
1649
1650 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1651 """
1652 return libconoptpy4.Conopt_setItLim(self, itlim)
1653
1654 def setErrLim(self, errlim):
1655 r"""
1656 @copydoc DEF_COI_ERRLIM
1657
1658
1659 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1660 """
1661 return libconoptpy4.Conopt_setErrLim(self, errlim)
1662
1663 def fVincLin(self, fvinclin):
1664 r"""
1665 @copydoc DEF_COI_FVINCLIN
1666
1667
1668 @ingroup REGISTRATION_OF_SIZES_PYTHON
1669 """
1670 return libconoptpy4.Conopt_fVincLin(self, fvinclin)
1671
1672 def fVforAll(self, fvforall):
1673 r"""
1674 @copydoc DEF_COI_FVFORALL
1675
1676
1677 @ingroup REGISTRATION_OF_SIZES_PYTHON
1678 """
1679 return libconoptpy4.Conopt_fVforAll(self, fvforall)
1680
1681 def setMaxSup(self, maxsup):
1682 r"""
1683 @copydoc DEF_COI_MAXSUP
1684
1685
1686 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1687 """
1688 return libconoptpy4.Conopt_setMaxSup(self, maxsup)
1689
1690 def allowEmptyRow(self, emptyrow):
1691 r"""
1692 @copydoc DEF_COI_EMPTYROW
1693
1694
1695 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1696 """
1697 return libconoptpy4.Conopt_allowEmptyRow(self, emptyrow)
1698
1699 def allowEmptyCol(self, emptycol):
1700 r"""
1701 @copydoc DEF_COI_EMPTYCOL
1702
1703
1704 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1705 """
1706 return libconoptpy4.Conopt_allowEmptyCol(self, emptycol)
1707
1708 def debug2D(self, debug2d):
1709 r"""
1710 @copydoc DEF_COI_DEBUG2D
1711
1712
1713 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1714 """
1715 return libconoptpy4.Conopt_debug2D(self, debug2d)
1716
1717 def disCont(self, discont):
1718 r"""
1719 @copydoc DEF_COI_DISCONT
1720
1721
1722 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1723 """
1724 return libconoptpy4.Conopt_disCont(self, discont)
1725
1726 def clearM(self, clearm):
1727 r"""
1728 @copydoc DEF_COI_CLEARM
1729
1730
1731 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1732 """
1733 return libconoptpy4.Conopt_clearM(self, clearm)
1734
1735 def setResLim(self, reslim):
1736 r"""
1737 @copydoc DEF_COI_RESLIM
1738
1739
1740 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1741 """
1742 return libconoptpy4.Conopt_setResLim(self, reslim)
1743
1744 def setMaxHeap(self, maxheap):
1745 r"""
1746 @copydoc DEF_COI_MAXHEAP
1747
1748
1749 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1750 """
1751 return libconoptpy4.Conopt_setMaxHeap(self, maxheap)
1752
1753 def setThreadS(self, threads):
1754 r"""
1755 @copydoc DEF_COI_THREADS
1756
1757
1758 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1759 """
1760 return libconoptpy4.Conopt_setThreadS(self, threads)
1761
1762 def setThreadF(self, threadf):
1763 r"""
1764 @copydoc DEF_COI_THREADF
1765
1766
1767 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1768 """
1769 return libconoptpy4.Conopt_setThreadF(self, threadf)
1770
1771 def setThread2D(self, thread2d):
1772 r"""
1773 @copydoc DEF_COI_THREAD2D
1774
1775
1776 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1777 """
1778 return libconoptpy4.Conopt_setThread2D(self, thread2d)
1779
1780 def setThreadC(self, threadc):
1781 r"""
1782 @copydoc DEF_COI_THREADC
1783
1784
1785 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1786 """
1787 return libconoptpy4.Conopt_setThreadC(self, threadc)
1788
1789 def getMaxThreads(self):
1790 r"""
1791 returns the maximum number of threads that can be used by CONOPT.
1792
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.
1797
1798
1799 @ingroup UTILITY_ROUTINES_PYTHON
1800 """
1801 return libconoptpy4.Conopt_getMaxThreads(self)
1802
1803 def getMaxHeapUsed(self):
1804 r"""
1805 After a model has been solved this method will return the amount of heap memory used.
1806
1807
1808 @ingroup UTILITY_ROUTINES_PYTHON
1809 """
1810 return libconoptpy4.Conopt_getMaxHeapUsed(self)
1811
1812 def getRangeErrors(self):
1813 r"""
1814 returns the range errors that were encountered.
1815
1816
1817 @ingroup UTILITY_ROUTINES_PYTHON
1818 """
1819 return libconoptpy4.Conopt_getRangeErrors(self)
1820
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
1840
1841SDEvaluationType_Constraint = libconoptpy4.SDEvaluationType_Constraint
1842
1843SDEvaluationType_Lagrangian = libconoptpy4.SDEvaluationType_Lagrangian
1844
1845class Variable(object):
1846 r"""
1847 the variable data
1848
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
1851 CONOPT.
1852
1853
1854 @ingroup QUERY_MODEL_PYTHON
1855 """
1856
1857 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
1858 __repr__ = _swig_repr
1859
1860 def __init__(self, idx, low, up, cur=0, varstat=-1):
1861 r"""
1862 __init__(Variable self, int idx, double low, double up, double cur=0, int varstat=-1) -> Variable
1863
1864 Parameters
1865 ----------
1866 idx: int
1867 low: double
1868 up: double
1869 cur: double
1870 varstat: int
1871
1872 """
1873 libconoptpy4.Variable_swiginit(self, libconoptpy4.new_Variable(idx, low, up, cur, varstat))
1874
1875 def addNonzero(self, conindex, value, nlflag):
1876 r"""
1877 adds a non-zero to the variable data
1878
1879 Notes: this is used internally.
1880 """
1881 return libconoptpy4.Variable_addNonzero(self, conindex, value, nlflag)
1882
1883 def sortNonzeros(self):
1884 r"""
1885 sorts the non-zeros by constraint index.
1886
1887 Notes: this is used internally.
1888 """
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
1900
1901# Register Variable in libconoptpy4:
1902libconoptpy4.Variable_swigregister(Variable)
1903class Constraint(object):
1904 r"""
1905 the constraint data
1906
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
1909 CONOPT.
1910
1911
1912 @ingroup QUERY_MODEL_PYTHON
1913 """
1914
1915 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
1916 __repr__ = _swig_repr
1917
1918 def __init__(self, idx, type, bound, slackstat):
1919 r"""
1920 __init__(Constraint self, int idx, ConoptConstraintType type, double bound, int slackstat) -> Constraint
1921
1922 Parameters
1923 ----------
1924 idx: int
1925 type: enum ConoptConstraintType
1926 bound: double
1927 slackstat: int
1928
1929 """
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
1936
1937# Register Constraint in libconoptpy4:
1938libconoptpy4.Constraint_swigregister(Constraint)
1939class ConoptModelData(object):
1940 r""" The Model Data class"""
1941
1942 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
1943 __repr__ = _swig_repr
1944
1945 def __init__(self):
1946 r""" Constructor"""
1947 if self.__class__ == ConoptModelData:
1948 _self = None
1949 else:
1950 _self = self
1951 libconoptpy4.ConoptModelData_swiginit(self, libconoptpy4.new_ConoptModelData(_self, ))
1952 __swig_destroy__ = libconoptpy4.delete_ConoptModelData
1953
1954 def readMatrix(self, lower, curr, upper, vsta, type, rhs, esta, colsta, rowno, value, nlflag, numvar, numcon, numnz):
1955 r"""
1956 loads the structure of the model into CONOPT.
1957
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'
1965
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
1968 CONOPT, you must:
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
1973 nonlinear terms).
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().
1978
1979
1980 """
1981 return libconoptpy4.ConoptModelData_readMatrix(self, lower, curr, upper, vsta, type, rhs, esta, colsta, rowno, value, nlflag, numvar, numcon, numnz)
1982
1983 def setProblemDimension(self, numvar, numcons, numnz, numnlnz):
1984 r"""
1985 sets the problem dimension. This is called if the user wants to implement a custom readMatrix() method.
1986
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.
1989
1990
1991
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
1996 """
1997 return libconoptpy4.ConoptModelData_setProblemDimension(self, numvar, numcons, numnz, numnlnz)
1998
1999 def addConstraint(self, *args):
2000 r"""
2001 *Overload 1:*
2002 adds a constraint to the problem. The non-zero coefficients are added later
2003
2004
2005
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
2009
2010 |
2011
2012 *Overload 2:*
2013 adds a constraint to the problem. The matrix non-zeros are added based on the supplied variables
2014
2015
2016
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
2023
2024 |
2025
2026 *Overload 3:*
2027 adds a constraint to the problem. The matrix non-zeros are added based on the supplied variables
2028
2029
2030
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
2037 """
2038 return libconoptpy4.ConoptModelData_addConstraint(self, *args)
2039
2040 def addVariable(self, *args):
2041 r"""
2042 *Overload 1:*
2043 adds a variable to the model. The non-zero coefficients are added later.
2044
2045
2046
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
2051
2052 |
2053
2054 *Overload 2:*
2055 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
2056
2057
2058
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
2066
2067 |
2068
2069 *Overload 3:*
2070 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
2071
2072
2073
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
2081
2082 |
2083
2084 *Overload 4:*
2085 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
2086
2087
2088
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
2096 """
2097 return libconoptpy4.ConoptModelData_addVariable(self, *args)
2098
2099 def setObjectiveElement(self, elem, elemindex):
2100 r"""
2101 sets the index for the objective variable or constraint
2102
2103
2104 """
2105 return libconoptpy4.ConoptModelData_setObjectiveElement(self, elem, elemindex)
2106
2107 def setOptimizationSense(self, sense):
2108 r"""
2109 sets the optimisation direction.
2110
2111
2112 """
2113 return libconoptpy4.ConoptModelData_setOptimizationSense(self, sense)
2114
2115 def setInitialStatusOption(self, inistat):
2116 r"""
2117 the setting to indicate how the initial status of the variables and slack variables will be handled.
2118
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.
2122
2123 If inistat == 1:
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
2130
2131 If inistat == 2:
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.
2142
2143
2144 """
2145 return libconoptpy4.ConoptModelData_setInitialStatusOption(self, inistat)
2146
2147 def numVar(self):
2148 r"""
2149 returns the number of variables in the model
2150
2151
2152 """
2153 return libconoptpy4.ConoptModelData_numVar(self)
2154
2155 def numCons(self):
2156 r"""
2157 returns the number of constraints in the model
2158
2159
2160 """
2161 return libconoptpy4.ConoptModelData_numCons(self)
2162
2163 def numHessianNonzeros(self):
2164 r"""
2165 returns the number of non-zeros in the Hessian
2166
2167
2168 """
2169 return libconoptpy4.ConoptModelData_numHessianNonzeros(self)
2170
2171 def getVariable(self, *args):
2172 r"""
2173 *Overload 1:*
2174 returns a reference to the variable object
2175
2176
2177
2178 |
2179
2180 *Overload 2:*
2181 returns a reference to the variable object
2182
2183
2184 """
2185 return libconoptpy4.ConoptModelData_getVariable(self, *args)
2186
2187 def getConstraint(self, *args):
2188 r"""
2189 *Overload 1:*
2190 returns a reference to the constraint object
2191
2192
2193
2194 |
2195
2196 *Overload 2:*
2197 returns a reference to the constraint object
2198
2199
2200 """
2201 return libconoptpy4.ConoptModelData_getConstraint(self, *args)
2202
2203 def setSDEvaluationType(self, sdevaltype):
2204 r"""
2205 informs CONOPT of the method for evaluating the second derivative
2206
2207
2208 """
2209 return libconoptpy4.ConoptModelData_setSDEvaluationType(self, sdevaltype)
2210
2211 def setSDLagrangianStructure(self, rownum, colnum):
2212 r"""
2213 sets the structure of the second derivatives of the Lagrangian
2214
2215
2216
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.
2219 """
2220 return libconoptpy4.ConoptModelData_setSDLagrangianStructure(self, rownum, colnum)
2221
2222 def getSDLagrangianRowNumbers(self):
2223 r""" returns the row numbers in the second derivative of the lagrangian structure"""
2224 return libconoptpy4.ConoptModelData_getSDLagrangianRowNumbers(self)
2225
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):
2230 self.this.disown()
2231 libconoptpy4.disown_ConoptModelData(self)
2232 return weakref.proxy(self)
2233
2234# Register ConoptModelData in libconoptpy4:
2235libconoptpy4.ConoptModelData_swigregister(ConoptModelData)
2236VerbosityLevel_VerbLevelMin = libconoptpy4.VerbosityLevel_VerbLevelMin
2237
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
2247
2248class ConoptAlgProgress(object):
2249 r"""Proxy of C++ ConoptAlgProgress class."""
2250
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.
2258 """)
2259 numnopt = property(libconoptpy4.ConoptAlgProgress_numnopt_get, libconoptpy4.ConoptAlgProgress_numnopt_set, doc=r"""
2260 Number of non-optimal variables. Will be 0 meaning undefined
2261 during phase 0.
2262 """)
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.
2268 """)
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
2272 """)
2273 rgmax = property(libconoptpy4.ConoptAlgProgress_rgmax_get, libconoptpy4.ConoptAlgProgress_rgmax_set, doc=r"""
2274 The numerically largest reduced gradient. RGMAX will be zero during
2275 phase 0
2276 """)
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""")
2279
2280 def __init__(self):
2281 r"""__init__(ConoptAlgProgress self) -> ConoptAlgProgress"""
2282 libconoptpy4.ConoptAlgProgress_swiginit(self, libconoptpy4.new_ConoptAlgProgress())
2283 __swig_destroy__ = libconoptpy4.delete_ConoptAlgProgress
2284
2285# Register ConoptAlgProgress in libconoptpy4:
2286libconoptpy4.ConoptAlgProgress_swigregister(ConoptAlgProgress)
2287class MessageHandler(object):
2288 r"""
2289 The message handler class
2290
2291 @ingroup MESSAGEHANDLER_PYTHON
2292 """
2293
2294 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
2295 __repr__ = _swig_repr
2296
2297 def __init__(self):
2298 r""" Constructor"""
2299 if self.__class__ == MessageHandler:
2300 _self = None
2301 else:
2302 _self = self
2303 libconoptpy4.MessageHandler_swiginit(self, libconoptpy4.new_MessageHandler(_self, ))
2304 __swig_destroy__ = libconoptpy4.delete_MessageHandler
2305
2306 def message(self, smsg, dmsg, nmsg, msgv):
2307 r"""
2308 virtual method for handling the messages.
2309
2310 This can be redefined by the user for alternative message handling
2311
2312 @include{doc} message_cb_intro.dox
2313
2314
2315 @ingroup MESSAGEHANDLER_PYTHON
2316
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.
2321 """
2322 return libconoptpy4.MessageHandler_message(self, smsg, dmsg, nmsg, msgv)
2323
2324 def errorMessage(self, rowno, colno, posno, msg):
2325 r"""
2326 virtual method for handling error messages.
2327
2328 This can be redefined by the user for alternative message handling
2329
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
2334 overall message.
2335
2336 There are some special cases for the three first arguments and the message
2337 should be interpreted accordingly. The special cases are:
2338
2339 - **COLNO = -1:** The message is about a row and `ROWNO` will be between 0
2340 and `NumCon-1`.
2341
2342 - **ROWNO = -1:** The message is about a column and `COLNO` will be between 0
2343 and `NumVar-1`.
2344
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`
2347 is -1.
2348
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
2352 Jacobian element.
2353
2354
2355 @ingroup MESSAGEHANDLER_PYTHON
2356
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.
2361 """
2362 return libconoptpy4.MessageHandler_errorMessage(self, rowno, colno, posno, msg)
2363
2364 def progress(self, progressdata):
2365 r"""
2366 progress(MessageHandler self, ConoptAlgProgress progressdata) -> int
2367
2368 Parameters
2369 ----------
2370 progressdata: ConoptAlgProgress const &
2371
2372 """
2373 return libconoptpy4.MessageHandler_progress(self, progressdata)
2374
2375 def sendMessage(self, msg):
2376 r"""
2377 sends a message to the message handler
2378
2379
2380 @ingroup MESSAGEHANDLER_PYTHON
2381 """
2382 return libconoptpy4.MessageHandler_sendMessage(self, msg)
2383
2384 def setVerbosityLevel(self, verblevel):
2385 r"""
2386 sets the verbosity level for messaging.
2387
2388 The effect of this will depend on how the user implements the custom message handler
2389
2390
2391 @ingroup MESSAGEHANDLER_PYTHON
2392 """
2393 return libconoptpy4.MessageHandler_setVerbosityLevel(self, verblevel)
2394 def __disown__(self):
2395 self.this.disown()
2396 libconoptpy4.disown_MessageHandler(self)
2397 return weakref.proxy(self)
2398
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):
2408 r"""
2409 A class that can be extended to build and solve a model using Conopt.
2410
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.
2413
2414 @ingroup MODELDATA_PYTHON
2415 """
2416
2417 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
2418 __repr__ = _swig_repr
2419
2420 def __init__(self):
2421 r"""
2422 __init__(ModelData self) -> ModelData
2423
2424 Parameters
2425 ----------
2426 self: PyObject *
2427
2428 """
2429 if self.__class__ == ModelData:
2430 _self = None
2431 else:
2432 _self = self
2433 libconoptpy4.ModelData_swiginit(self, libconoptpy4.new_ModelData(_self, ))
2434 __swig_destroy__ = libconoptpy4.delete_ModelData
2435
2436 def evaluateNonlinearTerm(self, x, rowno, ignerr, thread):
2437 r"""
2438 callback method for evaluating the nonlinear terms in a given row
2439
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.
2444
2445 @return the value of the nonlinear terms.
2446
2447 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2448
2449 @ingroup EVAL_NONLINEAR_FUNCTION_PYTHON
2450 """
2451 return libconoptpy4.ModelData_evaluateNonlinearTerm(self, x, rowno, ignerr, thread)
2452
2453 def evaluateNonlinearJacobian(self, x, rowno, jacnum, ignerr, thread):
2454 r"""
2455 callback method for evaluating the jacobian for the nonlinear terms in a given row
2456
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.
2462
2463 @return a vector the length of jacnum that contains the jacobian values for the referenced elements.
2464
2465 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2466
2467 @ingroup EVAL_NONLINEAR_FUNCTION_PYTHON
2468 """
2469 return libconoptpy4.ModelData_evaluateNonlinearJacobian(self, x, rowno, jacnum, ignerr, thread)
2470
2471 def initFDEvaluation(self, x, rowlist, mode, numthread, ignerr):
2472 r"""
2473 callback method for initialising the first derivative evaluation.
2474
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`.
2478
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.
2485
2486 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2487 """
2488 pass
2489
2490
2491
2492 def endFDEvaluation(self, ignerr):
2493 r"""
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.
2497
2498 @param ignerr: a boolean to indicate whether the current point is safe or unsafe.
2499
2500 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2501
2502 @ingroup EVAL_NONLINEAR_FUNCTION_PYTHON
2503 """
2504 return libconoptpy4.ModelData_endFDEvaluation(self, ignerr)
2505
2506 def evaluateSDLagrangian(self, x, u, hessianrow, hessiancol):
2507 r"""
2508 Computes and returns the numerical values of the Lagrangian of the Hessian
2509
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.
2514
2515 returns a vector for the values of the Lagrangian of the Hessian. The length of the vector is of size numHessianNonzeros().
2516
2517 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2518
2519 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2520 """
2521 return libconoptpy4.ModelData_evaluateSDLagrangian(self, x, u, hessianrow, hessiancol)
2522
2523 def evaluateSDDirLagrangian(self, x, dx, u, newpoint):
2524 r"""
2525 computes the directional second derivative for the Lagrangian
2526
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
2531 changed.
2532
2533 returns a vector for the directional second derivative. The length of the vector is the number of variables.
2534
2535 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2536
2537 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2538 """
2539 return libconoptpy4.ModelData_evaluateSDDirLagrangian(self, x, dx, u, newpoint)
2540
2541 def evaluateDirectionalSD(self, x, dx, rowno, jacnum, thread):
2542 r"""
2543 computes the directional second derivative for a single constraint
2544
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.
2550
2551 returns a vector for the directional second derivative. The length of the vector is the number of variables.
2552
2553 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2554
2555 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2556 """
2557 return libconoptpy4.ModelData_evaluateDirectionalSD(self, x, dx, rowno, jacnum, thread)
2558
2559 def initDirectionalSDEval(self, x, dx, rowlist, numthread, newpoint):
2560 r"""
2561 a callback for the initialisation of the second derivative evaluation.
2562
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.
2565
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
2571 changed.
2572
2573 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2574 """
2575 pass
2576
2577
2578
2579 def endDirectionalSDEval(self):
2580 r"""
2581 called by CONOPT after a sequence of evaluateDirectionalSD() calls each time either the point or the direction
2582 changes.
2583
2584 It can be used to perform cleanup tasks, including to report if anything went wrong.
2585
2586 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2587
2588 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2589 """
2590 return libconoptpy4.ModelData_endDirectionalSDEval(self)
2591
2592 def errorInEvaluation(self):
2593 r"""
2594 reports that an error occurred in the evaluation.
2595
2596 When executing evaluateNonlinearTerm() or evaluateNonlinearJacobian() the number of errors are counted and then
2597 if an error limit is exceeded, CONOPT will terminate.
2598
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.
2601 """
2602 return libconoptpy4.ModelData_errorInEvaluation(self)
2603
2604 def setProblemDimension(self, numvar, numcons, numnz, numnlnz):
2605 r"""
2606 sets the problem dimension. This is called if the user wants to implement a custom readMatrix() method.
2607
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.
2610
2611
2612 @ingroup DEFINE_MODEL_PYTHON
2613
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
2618 """
2619 return libconoptpy4.ModelData_setProblemDimension(self, numvar, numcons, numnz, numnlnz)
2620
2621 def addConstraint(self, *args):
2622 r"""
2623 *Overload 1:*
2624 adds a constraint to the problem. The non-zero coefficients are added later
2625
2626
2627 @ingroup DEFINE_MODEL_PYTHON
2628
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
2632
2633 |
2634
2635 *Overload 2:*
2636 adds a constraint to the problem. The non-zero coefficients are added later
2637
2638
2639 @ingroup DEFINE_MODEL_PYTHON
2640
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
2644
2645 |
2646
2647 *Overload 3:*
2648 adds a constraint to the problem. The matrix non-zeros are added based on the supplied variables
2649
2650
2651 @ingroup DEFINE_MODEL_PYTHON
2652
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
2659
2660 |
2661
2662 *Overload 4:*
2663 adds a constraint to the problem. The matrix non-zeros are added based on the supplied variables
2664
2665
2666 @ingroup DEFINE_MODEL_PYTHON
2667
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
2674 """
2675 return libconoptpy4.ModelData_addConstraint(self, *args)
2676
2677 def addVariable(self, *args):
2678 r"""
2679 *Overload 1:*
2680 adds a variable to the model. The non-zero coefficients are added later.
2681
2682
2683 @ingroup DEFINE_MODEL_PYTHON
2684
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
2689
2690 |
2691
2692 *Overload 2:*
2693 adds a variable to the model. The non-zero coefficients are added later.
2694
2695
2696 @ingroup DEFINE_MODEL_PYTHON
2697
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
2702
2703 |
2704
2705 *Overload 3:*
2706 adds a variable to the model. The non-zero coefficients are added later.
2707
2708
2709 @ingroup DEFINE_MODEL_PYTHON
2710
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
2715
2716 |
2717
2718 *Overload 4:*
2719 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
2720
2721
2722 @ingroup DEFINE_MODEL_PYTHON
2723
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
2731
2732 |
2733
2734 *Overload 5:*
2735 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
2736
2737
2738 @ingroup DEFINE_MODEL_PYTHON
2739
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
2747
2748 |
2749
2750 *Overload 6:*
2751 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
2752
2753
2754 @ingroup DEFINE_MODEL_PYTHON
2755
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
2763 """
2764 return libconoptpy4.ModelData_addVariable(self, *args)
2765
2766 def setObjectiveElement(self, elem, elemindex):
2767 r"""
2768 sets the index for the objective variable or constraint
2769
2770
2771 @ingroup DEFINE_MODEL_PYTHON
2772 """
2773 return libconoptpy4.ModelData_setObjectiveElement(self, elem, elemindex)
2774
2775 def setOptimizationSense(self, sense):
2776 r"""
2777 sets the optimisation direction.
2778
2779
2780 @ingroup DEFINE_MODEL_PYTHON
2781 """
2782 return libconoptpy4.ModelData_setOptimizationSense(self, sense)
2783
2784 def setInitialStatusOption(self, inistat):
2785 r"""
2786 the setting to indicate how the initial status of the variables and slack variables will be handled.
2787
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.
2791
2792 If inistat == 1:
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
2799
2800 If inistat == 2:
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.
2811
2812
2813 @ingroup DEFINE_MODEL_PYTHON
2814 """
2815 return libconoptpy4.ModelData_setInitialStatusOption(self, inistat)
2816
2817 def numVar(self):
2818 r"""
2819 returns the number of variables in the model
2820
2821
2822 @ingroup QUERY_MODEL_PYTHON
2823 """
2824 return libconoptpy4.ModelData_numVar(self)
2825
2826 def numCons(self):
2827 r"""
2828 returns the number of constraints in the model
2829
2830
2831 @ingroup QUERY_MODEL_PYTHON
2832 """
2833 return libconoptpy4.ModelData_numCons(self)
2834
2835 def numHessianNonzeros(self):
2836 r"""
2837 returns the number of non-zeros in the Hessian
2838
2839
2840 @ingroup QUERY_MODEL_PYTHON
2841 """
2842 return libconoptpy4.ModelData_numHessianNonzeros(self)
2843
2844 def getVariable(self, *args):
2845 r"""
2846 *Overload 1:*
2847 returns a reference to the variable object
2848
2849
2850 @ingroup QUERY_MODEL_PYTHON
2851
2852 |
2853
2854 *Overload 2:*
2855 returns a reference to the variable object
2856
2857
2858 @ingroup QUERY_MODEL_PYTHON
2859 """
2860 return libconoptpy4.ModelData_getVariable(self, *args)
2861
2862 def getConstraint(self, *args):
2863 r"""
2864 *Overload 1:*
2865 returns a reference to the constraint object
2866
2867
2868 @ingroup QUERY_MODEL_PYTHON
2869
2870 |
2871
2872 *Overload 2:*
2873 returns a reference to the constraint object
2874
2875
2876 @ingroup QUERY_MODEL_PYTHON
2877 """
2878 return libconoptpy4.ModelData_getConstraint(self, *args)
2879
2880 def setSDEvaluationType(self, sdevaltype):
2881 r"""
2882 informs CONOPT of the method for evaluating the second derivative
2883
2884
2885 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2886 """
2887 return libconoptpy4.ModelData_setSDEvaluationType(self, sdevaltype)
2888
2889 def setSDLagrangianStructure(self, rownum, colnum):
2890 r"""
2891 sets the structure of the second derivatives of the Lagrangian
2892
2893
2894 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2895
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.
2898 """
2899 return libconoptpy4.ModelData_setSDLagrangianStructure(self, rownum, colnum)
2900 def __disown__(self):
2901 self.this.disown()
2902 libconoptpy4.disown_ModelData(self)
2903 return weakref.proxy(self)
2904
2905# Register ModelData in libconoptpy4:
2906libconoptpy4.ModelData_swigregister(ModelData)
2907
Proxy of C++ swig::SwigPyIterator class.
Definition conopt.py:66
__init__(self, *args, **kwargs)
Definition conopt.py:71
incr(self, n=1)
incr(SwigPyIterator self, size_t n=1) -> SwigPyIterator
Definition conopt.py:80
distance(self, x)
distance(SwigPyIterator self, SwigPyIterator x) -> ptrdiff_t
Definition conopt.py:102
copy(self)
copy(SwigPyIterator self) -> SwigPyIterator
Definition conopt.py:124
decr(self, n=1)
decr(SwigPyIterator self, size_t n=1) -> SwigPyIterator
Definition conopt.py:91
equal(self, x)
equal(SwigPyIterator self, SwigPyIterator x) -> bool
Definition conopt.py:113
value(self)
value(SwigPyIterator self) -> PyObject *
Definition conopt.py:76
Meta class to enforce nondynamic attributes (no new attributes) for a class.
Definition conopt.py:59
_swig_setattr_nondynamic_instance_variable(set)
Definition conopt.py:30
_swig_repr(self)
Definition conopt.py:22
_swig_add_metaclass(metaclass)
Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six....
Definition conopt.py:52
_swig_setattr_nondynamic_class_variable(set)
Definition conopt.py:43