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