CONOPT
Loading...
Searching...
No Matches
pyconopt.py
Go to the documentation of this file.
3
4# This file was automatically generated by SWIG (https://www.swig.org).
5# Version 4.3.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 libconopt4_python
14else:
15 import libconopt4_python
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__ = libconopt4_python.delete_SwigPyIterator
75
76 def value(self):
77 r"""value(SwigPyIterator self) -> PyObject *"""
78 return libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.SwigPyIterator_equal(self, x)
123
124 def copy(self):
125 r"""copy(SwigPyIterator self) -> SwigPyIterator"""
126 return libconopt4_python.SwigPyIterator_copy(self)
127
128 def next(self):
129 r"""next(SwigPyIterator self) -> PyObject *"""
130 return libconopt4_python.SwigPyIterator_next(self)
131
132 def __next__(self):
133 r"""__next__(SwigPyIterator self) -> PyObject *"""
134 return libconopt4_python.SwigPyIterator___next__(self)
135
136 def previous(self):
137 r"""previous(SwigPyIterator self) -> PyObject *"""
138 return libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.SwigPyIterator___sub__(self, *args)
222 def __iter__(self):
223 return self
224
225# Register SwigPyIterator in libconopt4_python:
226libconopt4_python.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 libconopt4_python.IntVector_iterator(self)
236 def __iter__(self):
237 return self.iterator()
238
239 def __nonzero__(self):
240 r"""__nonzero__(IntVector self) -> bool"""
241 return libconopt4_python.IntVector___nonzero__(self)
242
243 def __bool__(self):
244 r"""__bool__(IntVector self) -> bool"""
245 return libconopt4_python.IntVector___bool__(self)
246
247 def __len__(self):
248 r"""__len__(IntVector self) -> std::vector< int >::size_type"""
249 return libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.IntVector___setitem__(self, *args)
353
354 def pop(self):
355 r"""pop(IntVector self) -> std::vector< int >::value_type"""
356 return libconopt4_python.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 libconopt4_python.IntVector_append(self, x)
368
369 def empty(self):
370 r"""empty(IntVector self) -> bool"""
371 return libconopt4_python.IntVector_empty(self)
372
373 def size(self):
374 r"""size(IntVector self) -> std::vector< int >::size_type"""
375 return libconopt4_python.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 libconopt4_python.IntVector_swap(self, v)
387
388 def begin(self):
389 r"""begin(IntVector self) -> std::vector< int >::iterator"""
390 return libconopt4_python.IntVector_begin(self)
391
392 def end(self):
393 r"""end(IntVector self) -> std::vector< int >::iterator"""
394 return libconopt4_python.IntVector_end(self)
395
396 def rbegin(self):
397 r"""rbegin(IntVector self) -> std::vector< int >::reverse_iterator"""
398 return libconopt4_python.IntVector_rbegin(self)
399
400 def rend(self):
401 r"""rend(IntVector self) -> std::vector< int >::reverse_iterator"""
402 return libconopt4_python.IntVector_rend(self)
403
404 def clear(self):
405 r"""clear(IntVector self)"""
406 return libconopt4_python.IntVector_clear(self)
407
408 def get_allocator(self):
409 r"""get_allocator(IntVector self) -> std::vector< int >::allocator_type"""
410 return libconopt4_python.IntVector_get_allocator(self)
411
412 def pop_back(self):
413 r"""pop_back(IntVector self)"""
414 return libconopt4_python.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 libconopt4_python.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 libconopt4_python.IntVector_swiginit(self, libconopt4_python.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 libconopt4_python.IntVector_push_back(self, x)
469
470 def front(self):
471 r"""front(IntVector self) -> std::vector< int >::value_type const &"""
472 return libconopt4_python.IntVector_front(self)
473
474 def back(self):
475 r"""back(IntVector self) -> std::vector< int >::value_type const &"""
476 return libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.IntVector_reserve(self, n)
538
539 def capacity(self):
540 r"""capacity(IntVector self) -> std::vector< int >::size_type"""
541 return libconopt4_python.IntVector_capacity(self)
542 __swig_destroy__ = libconopt4_python.delete_IntVector
543
544# Register IntVector in libconopt4_python:
545libconopt4_python.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 libconopt4_python.DoubleVector_iterator(self)
555 def __iter__(self):
556 return self.iterator()
557
558 def __nonzero__(self):
559 r"""__nonzero__(DoubleVector self) -> bool"""
560 return libconopt4_python.DoubleVector___nonzero__(self)
561
562 def __bool__(self):
563 r"""__bool__(DoubleVector self) -> bool"""
564 return libconopt4_python.DoubleVector___bool__(self)
565
566 def __len__(self):
567 r"""__len__(DoubleVector self) -> std::vector< double >::size_type"""
568 return libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.DoubleVector___setitem__(self, *args)
672
673 def pop(self):
674 r"""pop(DoubleVector self) -> std::vector< double >::value_type"""
675 return libconopt4_python.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 libconopt4_python.DoubleVector_append(self, x)
687
688 def empty(self):
689 r"""empty(DoubleVector self) -> bool"""
690 return libconopt4_python.DoubleVector_empty(self)
691
692 def size(self):
693 r"""size(DoubleVector self) -> std::vector< double >::size_type"""
694 return libconopt4_python.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 libconopt4_python.DoubleVector_swap(self, v)
706
707 def begin(self):
708 r"""begin(DoubleVector self) -> std::vector< double >::iterator"""
709 return libconopt4_python.DoubleVector_begin(self)
710
711 def end(self):
712 r"""end(DoubleVector self) -> std::vector< double >::iterator"""
713 return libconopt4_python.DoubleVector_end(self)
714
715 def rbegin(self):
716 r"""rbegin(DoubleVector self) -> std::vector< double >::reverse_iterator"""
717 return libconopt4_python.DoubleVector_rbegin(self)
718
719 def rend(self):
720 r"""rend(DoubleVector self) -> std::vector< double >::reverse_iterator"""
721 return libconopt4_python.DoubleVector_rend(self)
722
723 def clear(self):
724 r"""clear(DoubleVector self)"""
725 return libconopt4_python.DoubleVector_clear(self)
726
727 def get_allocator(self):
728 r"""get_allocator(DoubleVector self) -> std::vector< double >::allocator_type"""
729 return libconopt4_python.DoubleVector_get_allocator(self)
730
731 def pop_back(self):
732 r"""pop_back(DoubleVector self)"""
733 return libconopt4_python.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 libconopt4_python.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 libconopt4_python.DoubleVector_swiginit(self, libconopt4_python.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 libconopt4_python.DoubleVector_push_back(self, x)
788
789 def front(self):
790 r"""front(DoubleVector self) -> std::vector< double >::value_type const &"""
791 return libconopt4_python.DoubleVector_front(self)
792
793 def back(self):
794 r"""back(DoubleVector self) -> std::vector< double >::value_type const &"""
795 return libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.DoubleVector_reserve(self, n)
857
858 def capacity(self):
859 r"""capacity(DoubleVector self) -> std::vector< double >::size_type"""
860 return libconopt4_python.DoubleVector_capacity(self)
861 __swig_destroy__ = libconopt4_python.delete_DoubleVector
862
863# Register DoubleVector in libconopt4_python:
864libconopt4_python.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 libconopt4_python.StringVector_iterator(self)
874 def __iter__(self):
875 return self.iterator()
876
877 def __nonzero__(self):
878 r"""__nonzero__(StringVector self) -> bool"""
879 return libconopt4_python.StringVector___nonzero__(self)
880
881 def __bool__(self):
882 r"""__bool__(StringVector self) -> bool"""
883 return libconopt4_python.StringVector___bool__(self)
884
885 def __len__(self):
886 r"""__len__(StringVector self) -> std::vector< std::string >::size_type"""
887 return libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.StringVector___setitem__(self, *args)
991
992 def pop(self):
993 r"""pop(StringVector self) -> std::vector< std::string >::value_type"""
994 return libconopt4_python.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 libconopt4_python.StringVector_append(self, x)
1006
1007 def empty(self):
1008 r"""empty(StringVector self) -> bool"""
1009 return libconopt4_python.StringVector_empty(self)
1010
1011 def size(self):
1012 r"""size(StringVector self) -> std::vector< std::string >::size_type"""
1013 return libconopt4_python.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 libconopt4_python.StringVector_swap(self, v)
1025
1026 def begin(self):
1027 r"""begin(StringVector self) -> std::vector< std::string >::iterator"""
1028 return libconopt4_python.StringVector_begin(self)
1029
1030 def end(self):
1031 r"""end(StringVector self) -> std::vector< std::string >::iterator"""
1032 return libconopt4_python.StringVector_end(self)
1033
1034 def rbegin(self):
1035 r"""rbegin(StringVector self) -> std::vector< std::string >::reverse_iterator"""
1036 return libconopt4_python.StringVector_rbegin(self)
1037
1038 def rend(self):
1039 r"""rend(StringVector self) -> std::vector< std::string >::reverse_iterator"""
1040 return libconopt4_python.StringVector_rend(self)
1041
1042 def clear(self):
1043 r"""clear(StringVector self)"""
1044 return libconopt4_python.StringVector_clear(self)
1045
1046 def get_allocator(self):
1047 r"""get_allocator(StringVector self) -> std::vector< std::string >::allocator_type"""
1048 return libconopt4_python.StringVector_get_allocator(self)
1049
1050 def pop_back(self):
1051 r"""pop_back(StringVector self)"""
1052 return libconopt4_python.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 libconopt4_python.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 libconopt4_python.StringVector_swiginit(self, libconopt4_python.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 libconopt4_python.StringVector_push_back(self, x)
1107
1108 def front(self):
1109 r"""front(StringVector self) -> std::vector< std::string >::value_type const &"""
1110 return libconopt4_python.StringVector_front(self)
1111
1112 def back(self):
1113 r"""back(StringVector self) -> std::vector< std::string >::value_type const &"""
1114 return libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.StringVector_reserve(self, n)
1176
1177 def capacity(self):
1178 r"""capacity(StringVector self) -> std::vector< std::string >::size_type"""
1179 return libconopt4_python.StringVector_capacity(self)
1180 __swig_destroy__ = libconopt4_python.delete_StringVector
1181
1182# Register StringVector in libconopt4_python:
1183libconopt4_python.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 libconopt4_python.IntArray3_iterator(self)
1193 def __iter__(self):
1194 return self.iterator()
1195
1196 def __nonzero__(self):
1197 r"""__nonzero__(IntArray3 self) -> bool"""
1198 return libconopt4_python.IntArray3___nonzero__(self)
1199
1200 def __bool__(self):
1201 r"""__bool__(IntArray3 self) -> bool"""
1202 return libconopt4_python.IntArray3___bool__(self)
1203
1204 def __len__(self):
1205 r"""__len__(IntArray3 self) -> std::array< int,3 >::size_type"""
1206 return libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.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 libconopt4_python.IntArray3_swiginit(self, libconopt4_python.new_IntArray3(*args))
1322
1323 def empty(self):
1324 r"""empty(IntArray3 self) -> bool"""
1325 return libconopt4_python.IntArray3_empty(self)
1326
1327 def size(self):
1328 r"""size(IntArray3 self) -> std::array< int,3 >::size_type"""
1329 return libconopt4_python.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 libconopt4_python.IntArray3_swap(self, v)
1341
1342 def begin(self):
1343 r"""begin(IntArray3 self) -> std::array< int,3 >::iterator"""
1344 return libconopt4_python.IntArray3_begin(self)
1345
1346 def end(self):
1347 r"""end(IntArray3 self) -> std::array< int,3 >::iterator"""
1348 return libconopt4_python.IntArray3_end(self)
1349
1350 def rbegin(self):
1351 r"""rbegin(IntArray3 self) -> std::array< int,3 >::reverse_iterator"""
1352 return libconopt4_python.IntArray3_rbegin(self)
1353
1354 def rend(self):
1355 r"""rend(IntArray3 self) -> std::array< int,3 >::reverse_iterator"""
1356 return libconopt4_python.IntArray3_rend(self)
1357
1358 def front(self):
1359 r"""front(IntArray3 self) -> std::array< int,3 >::value_type const &"""
1360 return libconopt4_python.IntArray3_front(self)
1361
1362 def back(self):
1363 r"""back(IntArray3 self) -> std::array< int,3 >::value_type const &"""
1364 return libconopt4_python.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 libconopt4_python.IntArray3_fill(self, u)
1376 __swig_destroy__ = libconopt4_python.delete_IntArray3
1377
1378# Register IntArray3 in libconopt4_python:
1379libconopt4_python.IntArray3_swigregister(IntArray3)
1380CONOPT_INF = libconopt4_python.CONOPT_INF
1381
1382ConstraintType_Eq = libconopt4_python.ConstraintType_Eq
1383r"""equality constraint"""
1384ConstraintType_GtEq = libconopt4_python.ConstraintType_GtEq
1385r"""greater than or equal to constraint"""
1386ConstraintType_LtEq = libconopt4_python.ConstraintType_LtEq
1387r"""greater than or equal to constraint"""
1388ConstraintType_Free = libconopt4_python.ConstraintType_Free
1389r"""an unrestricted constraint. This is used when specifying the objective function."""
1390ObjectiveElement_Variable = libconopt4_python.ObjectiveElement_Variable
1391r"""the objective is given by a single variable"""
1392ObjectiveElement_Constraint = libconopt4_python.ObjectiveElement_Constraint
1393r"""the objective is given by the value of an equation"""
1394Sense_Minimize = libconopt4_python.Sense_Minimize
1395r"""a minimisation problem (default)"""
1396Sense_Maximize = libconopt4_python.Sense_Maximize
1397r"""a maximisation problem"""
1398VerbosityLevel_VerbLevelMin = libconopt4_python.VerbosityLevel_VerbLevelMin
1399
1400VerbosityLevel__None = libconopt4_python.VerbosityLevel__None
1401r"""turn off all output"""
1402VerbosityLevel_Normal = libconopt4_python.VerbosityLevel_Normal
1403r"""normal output, iteration log to stdout and error to stderr"""
1404VerbosityLevel_Error = libconopt4_python.VerbosityLevel_Error
1405r"""more detailed iteration log to stdout, error to stdout and stderr"""
1406VerbosityLevel_Debug = libconopt4_python.VerbosityLevel_Debug
1407r"""extensive iteration log, error to stdout and stderr"""
1408VerbosityLevel_VerbLevelMax = libconopt4_python.VerbosityLevel_VerbLevelMax
1409
1410SDEvaluationType__None = libconopt4_python.SDEvaluationType__None
1411
1412SDEvaluationType_Constraint = libconopt4_python.SDEvaluationType_Constraint
1413
1414SDEvaluationType_Lagrangian = libconopt4_python.SDEvaluationType_Lagrangian
1415
1416class Conopt(object):
1417 r"""
1418 The Conopt class
1419
1420 @ingroup CONOPT_PYTHON
1421 """
1422
1423 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
1424 __repr__ = _swig_repr
1425
1426 def __init__(self, *args):
1427 r"""
1428 Constructor
1429
1430 @param modelName: the name for the model.
1431
1432 """
1433 libconopt4_python.Conopt_swiginit(self, libconopt4_python.new_Conopt(*args))
1434 __swig_destroy__ = libconopt4_python.delete_Conopt
1435
1436 def solve(self):
1437 r"""
1438 @copydoc DEF_COI_SOLVE
1439
1440
1441 @ingroup UTILITY_ROUTINES_PYTHON
1442 """
1443 return libconopt4_python.Conopt_solve(self)
1444
1445 def checkModelAndParameters(self):
1446 r"""checks the model data and parameters to ensure it is setup correctly"""
1447 return libconopt4_python.Conopt_checkModelAndParameters(self)
1448
1449 def controlVector(self):
1450 r"""
1451 returns the control vector pointer.
1452
1453 This is for use in the C-interface methods
1454
1455
1456 @ingroup UTILITY_ROUTINES_PYTHON
1457 """
1458 return libconopt4_python.Conopt_controlVector(self)
1459
1460 def printStatus(self):
1461 r"""
1462 prints the status of the optimisation
1463
1464
1465 @ingroup UTILITY_ROUTINES_PYTHON
1466 """
1467 return libconopt4_python.Conopt_printStatus(self)
1468
1469 def getName(self):
1470 r"""
1471 returns the model name
1472
1473
1474 @ingroup UTILITY_ROUTINES_PYTHON
1475 """
1476 return libconopt4_python.Conopt_getName(self)
1477
1478 def loadModel(self, modeldata):
1479 r"""
1480 loads the model and stores the pointer in the interface
1481
1482 The user creates an instantiation of the ConoptModelData that includes all details of the model, including
1483 function evaluation callbacks. This method loads the model data into Conopt before solving the problem.
1484
1485 @param modeldata: a user defined ConoptModelData object
1486
1487
1488 @ingroup CONOPTPYTHON_MODELDATA
1489 """
1490 return libconopt4_python.Conopt_loadModel(self, modeldata)
1491
1492 def modelStatus(self):
1493 r"""
1494 returns the model status
1495
1496 """
1497 return libconopt4_python.Conopt_modelStatus(self)
1498
1499 def solutionStatus(self):
1500 r"""
1501 return the solution status
1502
1503
1504 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1505 """
1506 return libconopt4_python.Conopt_solutionStatus(self)
1507
1508 def iterations(self):
1509 r"""
1510 returns the number of iterations
1511
1512
1513 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1514 """
1515 return libconopt4_python.Conopt_iterations(self)
1516
1517 def objectiveValue(self):
1518 r"""
1519 returns the objective value
1520
1521
1522 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1523 """
1524 return libconopt4_python.Conopt_objectiveValue(self)
1525
1526 def getVariableValues(self):
1527 r"""
1528 returns the variable values
1529
1530
1531 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1532 """
1533 return libconopt4_python.Conopt_getVariableValues(self)
1534
1535 def getVariableMarginals(self):
1536 r"""
1537 returns the variable marginals
1538
1539
1540 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1541 """
1542 return libconopt4_python.Conopt_getVariableMarginals(self)
1543
1544 def getVariableBasisStatus(self):
1545 r"""
1546 returns the variable basis status
1547
1548
1549 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1550 """
1551 return libconopt4_python.Conopt_getVariableBasisStatus(self)
1552
1553 def getVariableStatus(self):
1554 r"""
1555 returns the variable status
1556
1557
1558 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1559 """
1560 return libconopt4_python.Conopt_getVariableStatus(self)
1561
1562 def getConstraintValues(self):
1563 r"""
1564 returns the constraint values
1565
1566
1567 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1568 """
1569 return libconopt4_python.Conopt_getConstraintValues(self)
1570
1571 def getConstraintMarginals(self):
1572 r"""
1573 returns the constraint marginals
1574
1575
1576 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1577 """
1578 return libconopt4_python.Conopt_getConstraintMarginals(self)
1579
1580 def getConstraintBasisStatus(self):
1581 r"""
1582 returns the constraint basis status
1583
1584
1585 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1586 """
1587 return libconopt4_python.Conopt_getConstraintBasisStatus(self)
1588
1589 def getConstraintStatus(self):
1590 r"""
1591 returns the constraint status
1592
1593
1594 @ingroup SOLUTION_STATUS_METHODS_PYTHON
1595 """
1596 return libconopt4_python.Conopt_getConstraintStatus(self)
1597
1598 def setMessageHandler(self, msghandler):
1599 r"""
1600 sets the message handler to the user supplied handler.
1601
1602 The pointer to the supplied message handler is stored in the interface object. The user is responsible for the
1603 creation and destruction of the message handler object.
1604
1605 @param msghandler: a user defined ConoptMessageHandler object
1606
1607
1608 @ingroup CONOPTPYTHON_MESSAGEHANDLER
1609 """
1610 return libconopt4_python.Conopt_setMessageHandler(self, msghandler)
1611
1612 def sendMessage(self, msg):
1613 r"""
1614 sends a message to the message handler
1615
1616 @param msg: A string for the message that will be processed in the message handler
1617
1618
1619 @ingroup CONOPTPYTHON_MESSAGEHANDLER
1620 """
1621 return libconopt4_python.Conopt_sendMessage(self, msg)
1622
1623 def setVerbosityLevel(self, verblevel):
1624 r"""
1625 sets the verbosity level for messaging
1626
1627 The verbosity level is:
1628 - None -- turn off all output
1629 - Normal -- normal output, iteration log to stdout and error to stderr
1630 - Error -- more detailed iteration log to stdout, error to stdout and stderr
1631 - Debug -- extensive iteration log, error to stdout and stderr
1632
1633 @param verblevel: the verbosity level for the message handler
1634
1635
1636 @ingroup CONOPTPYTHON_MESSAGEHANDLER
1637 """
1638 return libconopt4_python.Conopt_setVerbosityLevel(self, verblevel)
1639
1640 @staticmethod
1641 def version():
1642 r"""
1643 returns the version number.
1644
1645 It can be used to ensure that the modeler is linked to the correct version of the CONOPT DLL.
1646
1647
1648 @ingroup UTILITY_ROUTINES_PYTHON
1649 """
1650 return libconopt4_python.Conopt_version()
1651
1652 def debugFV(self, debugfv):
1653 r"""
1654 @copydoc DEF_COI_DEBUGFV
1655
1656
1657 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1658 """
1659 return libconopt4_python.Conopt_debugFV(self, debugfv)
1660
1661 def squareModel(self, square):
1662 r"""
1663 @copydoc DEF_COI_SQUARE
1664
1665
1666 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1667 """
1668 return libconopt4_python.Conopt_squareModel(self, square)
1669
1670 def setLicense(self, licint1, licint2, licint3, licstring):
1671 r"""
1672 @copydoc DEF_COI_LICENSE
1673
1674
1675 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1676 """
1677 return libconopt4_python.Conopt_setLicense(self, licint1, licint2, licint3, licstring)
1678
1679 def setItLim(self, itlim):
1680 r"""
1681 @copydoc DEF_COI_ITLIM
1682
1683
1684 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1685 """
1686 return libconopt4_python.Conopt_setItLim(self, itlim)
1687
1688 def setErrLim(self, errlim):
1689 r"""
1690 @copydoc DEF_COI_ERRLIM
1691
1692
1693 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1694 """
1695 return libconopt4_python.Conopt_setErrLim(self, errlim)
1696
1697 def fVincLin(self, fvinclin):
1698 r"""
1699 @copydoc DEF_COI_FVINCLIN
1700
1701
1702 @ingroup REGISTRATION_OF_SIZES_PYTHON
1703 """
1704 return libconopt4_python.Conopt_fVincLin(self, fvinclin)
1705
1706 def fVforAll(self, fvforall):
1707 r"""
1708 @copydoc DEF_COI_FVFORALL
1709
1710
1711 @ingroup REGISTRATION_OF_SIZES_PYTHON
1712 """
1713 return libconopt4_python.Conopt_fVforAll(self, fvforall)
1714
1715 def setMaxSup(self, maxsup):
1716 r"""
1717 @copydoc DEF_COI_MAXSUP
1718
1719
1720 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1721 """
1722 return libconopt4_python.Conopt_setMaxSup(self, maxsup)
1723
1724 def allowEmptyRow(self, emptyrow):
1725 r"""
1726 @copydoc DEF_COI_EMPTYROW
1727
1728
1729 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1730 """
1731 return libconopt4_python.Conopt_allowEmptyRow(self, emptyrow)
1732
1733 def allowEmptyCol(self, emptycol):
1734 r"""
1735 @copydoc DEF_COI_EMPTYCOL
1736
1737
1738 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1739 """
1740 return libconopt4_python.Conopt_allowEmptyCol(self, emptycol)
1741
1742 def debug2D(self, debug2d):
1743 r"""
1744 @copydoc DEF_COI_DEBUG2D
1745
1746
1747 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1748 """
1749 return libconopt4_python.Conopt_debug2D(self, debug2d)
1750
1751 def disCont(self, discont):
1752 r"""
1753 @copydoc DEF_COI_DISCONT
1754
1755
1756 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1757 """
1758 return libconopt4_python.Conopt_disCont(self, discont)
1759
1760 def clearM(self, clearm):
1761 r"""
1762 @copydoc DEF_COI_CLEARM
1763
1764
1765 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1766 """
1767 return libconopt4_python.Conopt_clearM(self, clearm)
1768
1769 def setResLim(self, reslim):
1770 r"""
1771 @copydoc DEF_COI_RESLIM
1772
1773
1774 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1775 """
1776 return libconopt4_python.Conopt_setResLim(self, reslim)
1777
1778 def setMaxHeap(self, maxheap):
1779 r"""
1780 @copydoc DEF_COI_MAXHEAP
1781
1782
1783 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1784 """
1785 return libconopt4_python.Conopt_setMaxHeap(self, maxheap)
1786
1787 def setThreadS(self, threads):
1788 r"""
1789 @copydoc DEF_COI_THREADS
1790
1791
1792 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1793 """
1794 return libconopt4_python.Conopt_setThreadS(self, threads)
1795
1796 def setThreadF(self, threadf):
1797 r"""
1798 @copydoc DEF_COI_THREADF
1799
1800
1801 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1802 """
1803 return libconopt4_python.Conopt_setThreadF(self, threadf)
1804
1805 def setThread2D(self, thread2d):
1806 r"""
1807 @copydoc DEF_COI_THREAD2D
1808
1809
1810 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1811 """
1812 return libconopt4_python.Conopt_setThread2D(self, thread2d)
1813
1814 def setThreadC(self, threadc):
1815 r"""
1816 @copydoc DEF_COI_THREADC
1817
1818
1819 @ingroup REGISTRATION_OF_OPTIONS_PYTHON
1820 """
1821 return libconopt4_python.Conopt_setThreadC(self, threadc)
1822
1823 def getMaxThreads(self):
1824 r"""
1825 returns the maximum number of threads that can be used by CONOPT.
1826
1827 If you are using multiple threads it may be necessary to know in advance how many threads CONOPT can use. If
1828 called inside a parallel loop, this method will return one---indicating that CONOPT cannot use multiple
1829 threads when CONOPT itself is called in parallel. Therefore, this method should be called in some sequential
1830 initialization code and not inside a function evaluation routine, that could be called in parallel.
1831
1832
1833 @ingroup UTILITY_ROUTINES_PYTHON
1834 """
1835 return libconopt4_python.Conopt_getMaxThreads(self)
1836
1837 def getMaxHeapUsed(self):
1838 r"""
1839 After a model has been solved this method will return the amount of heap memory used.
1840
1841
1842 @ingroup UTILITY_ROUTINES_PYTHON
1843 """
1844 return libconopt4_python.Conopt_getMaxHeapUsed(self)
1845
1846 def getRangeErrors(self):
1847 r"""
1848 returns the range errors that were encountered.
1849
1850
1851 @ingroup UTILITY_ROUTINES_PYTHON
1852 """
1853 return libconopt4_python.Conopt_getRangeErrors(self)
1854
1855# Register Conopt in libconopt4_python:
1856libconopt4_python.Conopt_swigregister(Conopt)
1857class Variable(object):
1858 r"""
1859 the variable data
1860
1861 This struct is used internally for supplying the variable data to CONOPT. The user is able to query this data from
1862 the ConoptModelData object. However, the user is not able to change the data after the variable has been added to
1863 CONOPT.
1864
1865
1866 @ingroup QUERY_MODEL_PYTHON
1867 """
1868
1869 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
1870 __repr__ = _swig_repr
1871
1872 def __init__(self, idx, low, up, cur=0, varstat=-1):
1873 r"""
1874 __init__(Variable self, int idx, double low, double up, double cur=0, int varstat=-1) -> Variable
1875
1876 Parameters
1877 ----------
1878 idx: int
1879 low: double
1880 up: double
1881 cur: double
1882 varstat: int
1883
1884 """
1885 libconopt4_python.Variable_swiginit(self, libconopt4_python.new_Variable(idx, low, up, cur, varstat))
1886
1887 def addNonzero(self, conindex, value, nlflag):
1888 r"""
1889 adds a non-zero to the variable data
1890
1891 Notes: this is used internally.
1892 """
1893 return libconopt4_python.Variable_addNonzero(self, conindex, value, nlflag)
1894
1895 def sortNonzeros(self):
1896 r"""
1897 sorts the non-zeros by constraint index.
1898
1899 Notes: this is used internally.
1900 """
1901 return libconopt4_python.Variable_sortNonzeros(self)
1902 index = property(libconopt4_python.Variable_index_get, libconopt4_python.Variable_index_set, doc=r"""the index of the variable in the problem""")
1903 lower = property(libconopt4_python.Variable_lower_get, libconopt4_python.Variable_lower_set, doc=r"""the lower bound of the variables""")
1904 upper = property(libconopt4_python.Variable_upper_get, libconopt4_python.Variable_upper_set, doc=r"""the upper bounds of the variables""")
1905 curr = property(libconopt4_python.Variable_curr_get, libconopt4_python.Variable_curr_set, doc=r"""the initial values of the variables. This is 0 by default.""")
1906 varstatus = property(libconopt4_python.Variable_varstatus_get, libconopt4_python.Variable_varstatus_set, doc=r"""the initial status of the variables. The depends on the COIDEF_IniStat setting.""")
1907 consindex_ = property(libconopt4_python.Variable_consindex__get, libconopt4_python.Variable_consindex__set, doc=r"""the index of the constraints""")
1908 value_ = property(libconopt4_python.Variable_value__get, libconopt4_python.Variable_value__set, doc=r"""the non-zero for linear terms, for non-linear terms this is ignored""")
1909 nlflag_ = property(libconopt4_python.Variable_nlflag__get, libconopt4_python.Variable_nlflag__set, doc=r"""indicator whether the non-zero is part of a non-linear term""")
1910 sortorder_ = property(libconopt4_python.Variable_sortorder__get, libconopt4_python.Variable_sortorder__set, doc=r"""a vector to support the sorting of the non-zeros""")
1911 __swig_destroy__ = libconopt4_python.delete_Variable
1912
1913# Register Variable in libconopt4_python:
1914libconopt4_python.Variable_swigregister(Variable)
1915class Constraint(object):
1916 r"""
1917 the constraint data
1918
1919 This struct is used internally for supplying the variable data to CONOPT. The user is able to query this data from
1920 the ConoptModelData object. However, the user is not able to change the data after the variable has been added to
1921 CONOPT.
1922
1923
1924 @ingroup QUERY_MODEL_PYTHON
1925 """
1926
1927 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
1928 __repr__ = _swig_repr
1929
1930 def __init__(self, idx, type, bound, slackstat):
1931 r"""
1932 __init__(Constraint self, int idx, ConoptConstraintType type, double bound, int slackstat) -> Constraint
1933
1934 Parameters
1935 ----------
1936 idx: int
1937 type: enum ConoptConstraintType
1938 bound: double
1939 slackstat: int
1940
1941 """
1942 libconopt4_python.Constraint_swiginit(self, libconopt4_python.new_Constraint(idx, type, bound, slackstat))
1943 index = property(libconopt4_python.Constraint_index_get, libconopt4_python.Constraint_index_set, doc=r"""the index of the constraint in the problem""")
1944 constype = property(libconopt4_python.Constraint_constype_get, libconopt4_python.Constraint_constype_set, doc=r"""0: equality, 1: greater than or equal, 2: less than or equal, 3: free row""")
1945 rhs = property(libconopt4_python.Constraint_rhs_get, libconopt4_python.Constraint_rhs_set, doc=r"""the right hand side of the constraint""")
1946 slackstatus = property(libconopt4_python.Constraint_slackstatus_get, libconopt4_python.Constraint_slackstatus_set, doc=r"""the initial status of the slacks. This depends on the COIDEF_IniStat setting.""")
1947 __swig_destroy__ = libconopt4_python.delete_Constraint
1948
1949# Register Constraint in libconopt4_python:
1950libconopt4_python.Constraint_swigregister(Constraint)
1951class ConoptModelData(object):
1952 r"""The Model Data class"""
1953
1954 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
1955 __repr__ = _swig_repr
1956
1957 def __init__(self):
1958 r"""Constructor"""
1959 if self.__class__ == ConoptModelData:
1960 _self = None
1961 else:
1962 _self = self
1963 libconopt4_python.ConoptModelData_swiginit(self, libconopt4_python.new_ConoptModelData(_self, ))
1964 __swig_destroy__ = libconopt4_python.delete_ConoptModelData
1965
1966 def readMatrix(self, lower, curr, upper, vsta, type, rhs, esta, colsta, rowno, value, nlflag, numvar, numcon, numnz):
1967 r"""
1968 loads the structure of the model into CONOPT.
1969
1970 Using the C++ interface, there are two ways to load the model into CONOPT.
1971 The first method follows the process used for the Fortran and C interfaces. This involves:
1972 1. setting the problem dimension by calling setProblemDimension().
1973 2. set the objective element (constraint or variable) by calling setObjectiveElement().
1974 3. set the optimisation sense by calling setOptimizationSense().
1975 4. implementing a readMatrix() method that loads the model using a column-oriented sparse matrix format. For
1976 more details regarding the parameters of the readMatrix() method, please see 'API_DEFINING_THE_MODEL_F90'
1977
1978 The second method makes use of the convenience functions included in the C++ interface. Within the
1979 ConoptModelData the methods addConstraint() and addVariable() are provided. As such, to load the model into
1980 CONOPT, you must:
1981 1. write a member function for building the model.
1982 2. in the build model function, call addVariable() for each variable to be added to the problem.
1983 3. in the build model function, call addConstraint() for each constraint to be added to the problem. When adding
1984 a constraint, you should specify the variables (by index), coefficients and non-linear flags (for all
1985 nonlinear terms).
1986 4. set the objective element (constraint or variable) by calling setObjectiveElement().
1987 5. set the optimisation sense by calling setOptimizationSense().
1988 When the solve method is called, the default readMatrix() method will be called, which will load the model into
1989 CONOPT as specified by the calls to addVariable() and addConstraint().
1990
1991
1992 """
1993 return libconopt4_python.ConoptModelData_readMatrix(self, lower, curr, upper, vsta, type, rhs, esta, colsta, rowno, value, nlflag, numvar, numcon, numnz)
1994
1995 def setProblemDimension(self, numvar, numcons, numnz, numnlnz):
1996 r"""
1997 sets the problem dimension. This is called if the user wants to implement a custom readMatrix() method.
1998
1999 NOTE: it is not possible to call setProblemDimension() and addConstraint() or addVariable(). The latter
2000 functions can only be used if the problem dimension is not set and the default readMatrix() method is used.
2001
2002
2003
2004 @param numvar: the number of variables in the problem
2005 @param numcons: the number of constraints in the problem
2006 @param numnz: the number of non-zeros in the constraint matrix
2007 @param numnlnz: the number of nonlinear non-zeros in the constraint matrix
2008 """
2009 return libconopt4_python.ConoptModelData_setProblemDimension(self, numvar, numcons, numnz, numnlnz)
2010
2011 def addConstraint(self, *args):
2012 r"""
2013 *Overload 1:*
2014 adds a constraint to the problem. The non-zero coefficients are added later
2015
2016
2017
2018 @param constype: the type of constraint, 0: ==, 1: >=, 2: <=, 3: free
2019 @param rhs: the right hand side
2020 @param slackstatus: initial status of the slack variables, see IniStat
2021
2022 |
2023
2024 *Overload 2:*
2025 adds a constraint to the problem. The matrix non-zeros are added based on the supplied variables
2026
2027
2028
2029 @param constype: the type of constraint, 0: ==, 1: >=, 2: <=, 3: free
2030 @param rhs: the right hand side
2031 @param varindex: the variables this constraint has non-zero coefficients
2032 @param value: the non-zero of the variable
2033 @param nlflag: flag to set whether the variable belongs to a non-linear term
2034 @param slackstatus: initial status of the slack variables, see IniStat
2035
2036 |
2037
2038 *Overload 3:*
2039 adds a constraint to the problem. The matrix non-zeros are added based on the supplied variables
2040
2041
2042
2043 @param constype: the type of constraint, 0: ==, 1: >=, 2: <=, 3: free
2044 @param rhs: the right hand side
2045 @param varindex: the variables this constraint has non-zero coefficients
2046 @param value: the non-zero of the variable
2047 @param nlflag: flag to set whether the variable belongs to a non-linear term
2048 @param slackstatus: initial status of the slack variables, see IniStat
2049 """
2050 return libconopt4_python.ConoptModelData_addConstraint(self, *args)
2051
2052 def addVariable(self, *args):
2053 r"""
2054 *Overload 1:*
2055 adds a variable to the model. The non-zero coefficients are added later.
2056
2057
2058
2059 @param lower: lower bound for the variable
2060 @param upper: upper bound for the variable
2061 @param curr: initial value of the variable, can be set to 0
2062 @param varstatus: initial status of the variable, see IniStat
2063
2064 |
2065
2066 *Overload 2:*
2067 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
2068
2069
2070
2071 @param lower: lower bound for the variable
2072 @param upper: upper bound for the variable
2073 @param consindex: the constraints this variable has non-zero coefficients
2074 @param value: the non-zero of the variable
2075 @param nlflag: flag to set whether the variable belongs to a non-linear term
2076 @param curr: initial value of the variable, can be set to 0
2077 @param varstatus: initial status of the variable, see IniStat
2078
2079 |
2080
2081 *Overload 3:*
2082 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
2083
2084
2085
2086 @param lower: lower bound for the variable
2087 @param upper: upper bound for the variable
2088 @param consindex: the constraints this variable has non-zero coefficients
2089 @param value: the non-zero of the variable
2090 @param nlflag: flag to set whether the variable belongs to a non-linear term
2091 @param curr: initial value of the variable, can be set to 0
2092 @param varstatus: initial status of the variable, see IniStat
2093
2094 |
2095
2096 *Overload 4:*
2097 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
2098
2099
2100
2101 @param lower: lower bound for the variable
2102 @param upper: upper bound for the variable
2103 @param consindex: the constraints this variable has non-zero coefficients
2104 @param value: the non-zero of the variable
2105 @param nlflag: flag to set whether the variable belongs to a non-linear term
2106 @param curr: initial value of the variable, can be set to 0
2107 @param varstatus: initial status of the variable, see IniStat
2108 """
2109 return libconopt4_python.ConoptModelData_addVariable(self, *args)
2110
2111 def setObjectiveElement(self, elem, elemindex):
2112 r"""
2113 sets the index for the objective variable or constraint
2114
2115
2116 """
2117 return libconopt4_python.ConoptModelData_setObjectiveElement(self, elem, elemindex)
2118
2119 def setOptimizationSense(self, sense):
2120 r"""
2121 sets the optimisation direction.
2122
2123
2124 """
2125 return libconopt4_python.ConoptModelData_setOptimizationSense(self, sense)
2126
2127 def setInitialStatusOption(self, inistat):
2128 r"""
2129 the setting to indicate how the initial status of the variables and slack variables will be handled.
2130
2131 The initial status is set in the addVariable() and addConstraint() methods, or in the readMatrix() method if the
2132 classical model input approach is used. By default, the value of inistat is 0, which means that the variable and
2133 slack status is ignored.
2134
2135 If inistat == 1:
2136 The variable status has the following behaviour:
2137 - 0: The variable is initialized non-basic (if curr = lower or curr = upper) or super-basic, and
2138 - 1: The variable is initialized basic
2139 The slack status has the following behaviour:
2140 - 0: The slack is initialized non-basic (if the constraint is binding in the initial point) or super-basic,
2141 - 1: The slack is initialized basic
2142
2143 If inistat == 2:
2144 The variable status has the following behaviour:
2145 - 0: The variable is initialized at lower bound
2146 - 1: The variable is initialized at upper bound
2147 - 2: The variable is initialized basic, and
2148 - 3: The variable is initialized superbasic.
2149 The slack status has the following behaviour:
2150 - 0: The slack is initialized at lower bound.
2151 - 1: The slack is initialized at upper bound.
2152 - 2: The slack is initialized basic, and
2153 - 3: The slack is initialized superbasic.
2154
2155
2156 """
2157 return libconopt4_python.ConoptModelData_setInitialStatusOption(self, inistat)
2158
2159 def numVar(self):
2160 r"""
2161 returns the number of variables in the model
2162
2163
2164 """
2165 return libconopt4_python.ConoptModelData_numVar(self)
2166
2167 def numCons(self):
2168 r"""
2169 returns the number of constraints in the model
2170
2171
2172 """
2173 return libconopt4_python.ConoptModelData_numCons(self)
2174
2175 def numHessianNonzeros(self):
2176 r"""
2177 returns the number of non-zeros in the Hessian
2178
2179
2180 """
2181 return libconopt4_python.ConoptModelData_numHessianNonzeros(self)
2182
2183 def getVariable(self, index):
2184 r"""
2185 returns a reference to the variable object
2186
2187
2188 """
2189 return libconopt4_python.ConoptModelData_getVariable(self, index)
2190
2191 def getConstraint(self, index):
2192 r"""
2193 returns a reference to the constraint object
2194
2195
2196 """
2197 return libconopt4_python.ConoptModelData_getConstraint(self, index)
2198
2199 def setSDEvaluationType(self, sdevaltype):
2200 r"""
2201 informs CONOPT of the method for evaluating the second derivative
2202
2203
2204 """
2205 return libconopt4_python.ConoptModelData_setSDEvaluationType(self, sdevaltype)
2206
2207 def setSDLagrangianStructure(self, rownum, colnum):
2208 r"""
2209 sets the structure of the second derivatives of the Lagrangian
2210
2211
2212
2213 @param rownum: Vector of row numbers of the lower triangular part of the Hessian.
2214 @param colnum: Vector of column numbers of the lower triangular part of the Hessian.
2215 """
2216 return libconopt4_python.ConoptModelData_setSDLagrangianStructure(self, rownum, colnum)
2217
2218 def getSDLagrangianRowNumbers(self):
2219 r"""returns the row numbers in the second derivative of the lagrangian structure"""
2220 return libconopt4_python.ConoptModelData_getSDLagrangianRowNumbers(self)
2221
2222 def getSDLagrangianColumnNumbers(self):
2223 r"""returns the column numbers in the second derivative of the lagrangian structure"""
2224 return libconopt4_python.ConoptModelData_getSDLagrangianColumnNumbers(self)
2225 def __disown__(self):
2226 self.this.disown()
2227 libconopt4_python.disown_ConoptModelData(self)
2228 return weakref.proxy(self)
2229
2230# Register ConoptModelData in libconopt4_python:
2231libconopt4_python.ConoptModelData_swigregister(ConoptModelData)
2232class ConoptAlgProgress(object):
2233 r"""Proxy of C++ ConoptAlgProgress class."""
2234
2235 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
2236 __repr__ = _swig_repr
2237 iteration = property(libconopt4_python.ConoptAlgProgress_iteration_get, libconopt4_python.ConoptAlgProgress_iteration_set, doc=r"""Number of the iteration.""")
2238 phase = property(libconopt4_python.ConoptAlgProgress_phase_get, libconopt4_python.ConoptAlgProgress_phase_set, doc=r"""The phase of the optimization.""")
2239 numinfeas = property(libconopt4_python.ConoptAlgProgress_numinfeas_get, libconopt4_python.ConoptAlgProgress_numinfeas_set, doc=r"""
2240 Number of infeasible constraints. In phase 0, this number will only
2241 count the number of "difficult" constraints.
2242 """)
2243 numnopt = property(libconopt4_python.ConoptAlgProgress_numnopt_get, libconopt4_python.ConoptAlgProgress_numnopt_set, doc=r"""
2244 Number of non-optimal variables. Will be 0 meaning undefined
2245 during phase 0.
2246 """)
2247 numsuper = property(libconopt4_python.ConoptAlgProgress_numsuper_get, libconopt4_python.ConoptAlgProgress_numsuper_set, doc=r"""Number of super-basic variables. Will be zero during phase 0 .""")
2248 suminfeas = property(libconopt4_python.ConoptAlgProgress_suminfeas_get, libconopt4_python.ConoptAlgProgress_suminfeas_set, doc=r"""
2249 Sum of the infeasibilities. In phase 0 it will include the
2250 infeasibilities in both easy and difficult constraint. During phase
2251 3 and 4 SUMINF will be 0.
2252 """)
2253 objvalue = property(libconopt4_python.ConoptAlgProgress_objvalue_get, libconopt4_python.ConoptAlgProgress_objvalue_set, doc=r"""
2254 The value of the true objective function. OBJVAL is zero meaning
2255 undefined during phase 0, 1 and 2
2256 """)
2257 rgmax = property(libconopt4_python.ConoptAlgProgress_rgmax_get, libconopt4_python.ConoptAlgProgress_rgmax_set, doc=r"""
2258 The numerically largest reduced gradient. RGMAX will be zero during
2259 phase 0
2260 """)
2261 step = property(libconopt4_python.ConoptAlgProgress_step_get, libconopt4_python.ConoptAlgProgress_step_set, doc=r"""The optimal steplength.""")
2262 numvar = property(libconopt4_python.ConoptAlgProgress_numvar_get, libconopt4_python.ConoptAlgProgress_numvar_set, doc=r"""The number of variables""")
2263
2264 def __init__(self):
2265 r"""__init__(ConoptAlgProgress self) -> ConoptAlgProgress"""
2266 libconopt4_python.ConoptAlgProgress_swiginit(self, libconopt4_python.new_ConoptAlgProgress())
2267 __swig_destroy__ = libconopt4_python.delete_ConoptAlgProgress
2268
2269# Register ConoptAlgProgress in libconopt4_python:
2270libconopt4_python.ConoptAlgProgress_swigregister(ConoptAlgProgress)
2271class MessageHandler(object):
2272 r"""
2273 The message handler class
2274
2275 @ingroup MESSAGEHANDLER_PYTHON
2276 """
2277
2278 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
2279 __repr__ = _swig_repr
2280
2281 def __init__(self):
2282 r"""Constructor"""
2283 if self.__class__ == MessageHandler:
2284 _self = None
2285 else:
2286 _self = self
2287 libconopt4_python.MessageHandler_swiginit(self, libconopt4_python.new_MessageHandler(_self, ))
2288 __swig_destroy__ = libconopt4_python.delete_MessageHandler
2289
2290 def message(self, smsg, dmsg, nmsg, msgv):
2291 r"""
2292 virtual method for handling the messages.
2293
2294 This can be redefined by the user for alternative message handling
2295
2296 @include{doc} message_cb_intro.dox
2297
2298
2299 @ingroup MESSAGEHANDLER_PYTHON
2300
2301 @param smsg: The number of lines in the message that should go to the Screen file. Between 0 and 30.
2302 @param dmsg: The number of lines in the message that should go to the Status file. Between 0 and 30.
2303 @param nmsg: The number of lines in the message that should go to the Documentation file. Between 0 and 30.
2304 @param msgv: Vector with the actual message lines.
2305 """
2306 return libconopt4_python.MessageHandler_message(self, smsg, dmsg, nmsg, msgv)
2307
2308 def errorMessage(self, rowno, colno, posno, msg):
2309 r"""
2310 virtual method for handling error messages.
2311
2312 This can be redefined by the user for alternative message handling
2313
2314 Messages about particular parts of a model are all one line long. The messages
2315 can be related to an error or it can be a general informative message related to
2316 a row or column or Jacobian element. The modeler is responsible for combining
2317 the row and column identification and the message text and for displaying the
2318 overall message.
2319
2320 There are some special cases for the three first arguments and the message
2321 should be interpreted accordingly. The special cases are:
2322
2323 - **COLNO = -1:** The message is about a row and `ROWNO` will be between 0
2324 and `NumCon-1`.
2325
2326 - **ROWNO = -1:** The message is about a column and `COLNO` will be between 0
2327 and `NumVar-1`.
2328
2329 - **ROWNO and COLNO both non-negative:** The message is about a position in
2330 the Jacobian if `POSNO` is non-negative and about a (row,column)-pair if `POSNO`
2331 is -1.
2332
2333 Examples of message texts are "Inconsistent lower and upper bounds." and "The
2334 variable has reached 'infinity.'" for a column, "The slack has reached
2335 'infinity.'" for a row and "Initial Jacobian element was not defined." for a
2336 Jacobian element.
2337
2338
2339 @ingroup MESSAGEHANDLER_PYTHON
2340
2341 @param rowno: The number of a row in the matrix.
2342 @param colno: The number of a column in the matrix.
2343 @param posno: The number of a Jacobian element in the matrix.
2344 @param msg: The actual message.
2345 """
2346 return libconopt4_python.MessageHandler_errorMessage(self, rowno, colno, posno, msg)
2347
2348 def progress(self, progressdata):
2349 r"""
2350 progress(MessageHandler self, ConoptAlgProgress progressdata) -> int
2351
2352 Parameters
2353 ----------
2354 progressdata: ConoptAlgProgress const &
2355
2356 """
2357 return libconopt4_python.MessageHandler_progress(self, progressdata)
2358
2359 def sendMessage(self, msg):
2360 r"""
2361 sends a message to the message handler
2362
2363
2364 @ingroup MESSAGEHANDLER_PYTHON
2365 """
2366 return libconopt4_python.MessageHandler_sendMessage(self, msg)
2367
2368 def setVerbosityLevel(self, verblevel):
2369 r"""
2370 sets the verbosity level for messaging.
2371
2372 The effect of this will depend on how the user implements the custom message handler
2373
2374
2375 @ingroup MESSAGEHANDLER_PYTHON
2376 """
2377 return libconopt4_python.MessageHandler_setVerbosityLevel(self, verblevel)
2378 def __disown__(self):
2379 self.this.disown()
2380 libconopt4_python.disown_MessageHandler(self)
2381 return weakref.proxy(self)
2382
2383# Register MessageHandler in libconopt4_python:
2384libconopt4_python.MessageHandler_swigregister(MessageHandler)
2385EvaluationMode_TermsOnly = libconopt4_python.EvaluationMode_TermsOnly
2386r"""only the nonlinear terms will be evaluated."""
2387EvaluationMode_JacobianOnly = libconopt4_python.EvaluationMode_JacobianOnly
2388r"""only the Jacobian of the nonlinear terms will be evaluated."""
2389EvaluationMode_Both = libconopt4_python.EvaluationMode_Both
2390r"""both the nonlinear terms and Jacobian will be evaluated."""
2391class ModelData(ConoptModelData):
2392 r"""
2393 A class that can be extended to build and solve a model using Conopt.
2394
2395 This class is the base class that is used for the extended interfaces for Conopt, namely Python and Java. The
2396 virtual methods included in this class can be redefined in the native languages.
2397
2398 @ingroup MODELDATA_PYTHON
2399 """
2400
2401 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
2402 __repr__ = _swig_repr
2403
2404 def __init__(self):
2405 r"""
2406 __init__(ModelData self) -> ModelData
2407
2408 Parameters
2409 ----------
2410 self: PyObject *
2411
2412 """
2413 if self.__class__ == ModelData:
2414 _self = None
2415 else:
2416 _self = self
2417 libconopt4_python.ModelData_swiginit(self, libconopt4_python.new_ModelData(_self, ))
2418 __swig_destroy__ = libconopt4_python.delete_ModelData
2419
2420 def evaluateNonlinearTerm(self, x, rowno, ignerr, thread):
2421 r"""
2422 callback method for evaluating the nonlinear terms in a given row
2423
2424 @param x: the solution vector that needs to be evaluated.
2425 @param rowno: the number for the row in which the nonlinear term exists.
2426 @param ignerr: a boolean to indicate whether the current point is safe or unsafe.
2427 @param thread: the index of the thread from which this method is being called from.
2428
2429 @return the value of the nonlinear terms.
2430
2431 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2432
2433 @ingroup EVAL_NONLINEAR_FUNCTION_PYTHON
2434 """
2435 return libconopt4_python.ModelData_evaluateNonlinearTerm(self, x, rowno, ignerr, thread)
2436
2437 def evaluateNonlinearJacobian(self, x, rowno, jacnum, ignerr, thread):
2438 r"""
2439 callback method for evaluating the jacobian for the nonlinear terms in a given row
2440
2441 @param x: the solution vector that needs to be evaluated.
2442 @param rowno: the number for the row in which the nonlinear term exists.
2443 @param jacnum: vector with a list of column numbers for the nonlinear nonzero Jacobian elements in the row.
2444 @param ignerr: a boolean to indicate whether the current point is safe or unsafe.
2445 @param thread: the index of the thread from which this method is being called from.
2446
2447 @return a vector the length of jacnum that contains the jacobian values for the referenced elements.
2448
2449 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2450
2451 @ingroup EVAL_NONLINEAR_FUNCTION_PYTHON
2452 """
2453 return libconopt4_python.ModelData_evaluateNonlinearJacobian(self, x, rowno, jacnum, ignerr, thread)
2454
2455 def initFDEvaluation(self, x, rowlist, mode, numthread, ignerr):
2456 r"""
2457 callback method for initialising the first derivative evaluation.
2458
2459 If defined, this method will be called each time the point of interest
2460 has changed, and it will define the coming point and tell which constraints
2461 CONOPT will need during the following calls to `evaluateNonlinearTerm` and `evaluateNonlinearJacobian`.
2462
2463 @param x: the solution vector that needs to be evaluated.
2464 @param rowlist: the list of rows that will be evaluated for the given point.
2465 @param mode: the evaluation mode for the current iteration. This is either TermsOnly, JacobianOnly or Both. See
2466 EvaluationMode for more details.
2467 @param numthread: the number of threads that will be used for the following FDEval calls.
2468 @param ignerr: a boolean to indicate whether the current point is safe or unsafe.
2469
2470 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2471 """
2472 pass
2473
2474
2475
2476 def endFDEvaluation(self, ignerr):
2477 r"""
2478 Optional function, if defined, it will be called at the end of the function evaluation stage.
2479 This can be used to clean up any user data generated, such as in `FDEvalIni`, that was used to improve
2480 the efficiency of the function and derivative evaluation.
2481
2482 @param ignerr: a boolean to indicate whether the current point is safe or unsafe.
2483
2484 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2485
2486 @ingroup EVAL_NONLINEAR_FUNCTION_PYTHON
2487 """
2488 return libconopt4_python.ModelData_endFDEvaluation(self, ignerr)
2489
2490 def evaluateSDLagrangian(self, x, u, hessianrow, hessiancol):
2491 r"""
2492 Computes and returns the numerical values of the Lagrangian of the Hessian
2493
2494 @param x: the solution vector that needs to be evaluated.
2495 @param u: the vector of weights on the individual constraints.
2496 @param hessianrow: vector of row numbers of the lower triangular part of the hessian.
2497 @param hessiancol: vector of column numbers of the lower triangular part of the hessian.
2498
2499 returns a vector for the values of the Lagrangian of the Hessian. The length of the vector is of size numHessianNonzeros().
2500
2501 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2502
2503 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2504 """
2505 return libconopt4_python.ModelData_evaluateSDLagrangian(self, x, u, hessianrow, hessiancol)
2506
2507 def evaluateSDDirLagrangian(self, x, dx, u, newpoint):
2508 r"""
2509 computes the directional second derivative for the Lagrangian
2510
2511 @param x: the solution vector that needs to be evaluated.
2512 @param dx: vector with the direction in which the directional second derivatives should be computed.
2513 @param u: the vector of weights on the individual constraints.
2514 @param newpoint: a boolean to indicate whether x has changed. If newpoint is false, the values of dx may have
2515 changed.
2516
2517 returns a vector for the directional second derivative. The length of the vector is the number of variables.
2518
2519 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2520
2521 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2522 """
2523 return libconopt4_python.ModelData_evaluateSDDirLagrangian(self, x, dx, u, newpoint)
2524
2525 def evaluateDirectionalSD(self, x, dx, rowno, jacnum, thread):
2526 r"""
2527 computes the directional second derivative for a single constraint
2528
2529 @param x: the solution vector that needs to be evaluated.
2530 @param dx: vector with the direction in which the directional second derivatives should be computed.
2531 @param rowno: the number for the row in which the nonlinear term exists.
2532 @param jacnum: vector with a list of column numbers for the nonlinear nonzero Jacobian elements in the row.
2533 @param thread: the index of the thread from which this method is being called from.
2534
2535 returns a vector for the directional second derivative. The length of the vector is the number of variables.
2536
2537 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2538
2539 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2540 """
2541 return libconopt4_python.ModelData_evaluateDirectionalSD(self, x, dx, rowno, jacnum, thread)
2542
2543 def initDirectionalSDEval(self, x, dx, rowlist, numthread, newpoint):
2544 r"""
2545 a callback for the initialisation of the second derivative evaluation.
2546
2547 This method is called before a sequence of calls to evaluateDirectionalSD(). The user can utilise this method
2548 for evaluating common terms and storing important information.
2549
2550 @param x: the solution vector that needs to be evaluated.
2551 @param dx: vector with the direction in which the directional second derivatives should be computed.
2552 @param rowlist: the list of rows that will be evaluated for the given point.
2553 @param mode: the evaluation mode for the current iteration. This is either TermsOnly, JacobianOnly or Both. See
2554 EvaluationMode for more details.
2555 @param numthread: the number of threads that will be used for the following FDEval calls.
2556 @param newpoint: a boolean to indicate whether x has changed. If newpoint is false, the values of dx may have
2557 changed.
2558
2559 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2560 """
2561 pass
2562
2563
2564
2565 def endDirectionalSDEval(self):
2566 r"""
2567 called by CONOPT after a sequence of evaluateDirectionalSD() calls each time either the point or the direction
2568 changes.
2569
2570 It can be used to perform cleanup tasks, including to report if anything went wrong.
2571
2572 Notes: an error in the evaluation is reported by calling errorInEvaluation()
2573
2574 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2575 """
2576 return libconopt4_python.ModelData_endDirectionalSDEval(self)
2577
2578 def errorInEvaluation(self):
2579 r"""
2580 reports that an error occurred in the evaluation.
2581
2582 When executing evaluateNonlinearTerm() or evaluateNonlinearJacobian() the number of errors are counted and then
2583 if an error limit is exceeded, CONOPT will terminate.
2584
2585 When evaluating second derivative information, any errors reported will inform CONOPT that it is unable to use
2586 second order methods for the current point.
2587 """
2588 return libconopt4_python.ModelData_errorInEvaluation(self)
2589
2590 def setProblemDimension(self, numvar, numcons, numnz, numnlnz):
2591 r"""
2592 sets the problem dimension. This is called if the user wants to implement a custom readMatrix() method.
2593
2594 NOTE: it is not possible to call setProblemDimension() and addConstraint() or addVariable(). The latter
2595 functions can only be used if the problem dimension is not set and the default readMatrix() method is used.
2596
2597
2598 @ingroup DEFINE_MODEL_PYTHON
2599
2600 @param numvar: the number of variables in the problem
2601 @param numcons: the number of constraints in the problem
2602 @param numnz: the number of non-zeros in the constraint matrix
2603 @param numnlnz: the number of nonlinear non-zeros in the constraint matrix
2604 """
2605 return libconopt4_python.ModelData_setProblemDimension(self, numvar, numcons, numnz, numnlnz)
2606
2607 def addConstraint(self, *args):
2608 r"""
2609 *Overload 1:*
2610 adds a constraint to the problem. The non-zero coefficients are added later
2611
2612
2613 @ingroup DEFINE_MODEL_PYTHON
2614
2615 @param constype: the type of constraint, 0: ==, 1: >=, 2: <=, 3: free
2616 @param rhs: the right hand side
2617 @param slackstatus: initial status of the slack variables, see IniStat
2618
2619 |
2620
2621 *Overload 2:*
2622 adds a constraint to the problem. The non-zero coefficients are added later
2623
2624
2625 @ingroup DEFINE_MODEL_PYTHON
2626
2627 @param constype: the type of constraint, 0: ==, 1: >=, 2: <=, 3: free
2628 @param rhs: the right hand side
2629 @param slackstatus: initial status of the slack variables, see IniStat
2630
2631 |
2632
2633 *Overload 3:*
2634 adds a constraint to the problem. The matrix non-zeros are added based on the supplied variables
2635
2636
2637 @ingroup DEFINE_MODEL_PYTHON
2638
2639 @param constype: the type of constraint, 0: ==, 1: >=, 2: <=, 3: free
2640 @param rhs: the right hand side
2641 @param varindex: the variables this constraint has non-zero coefficients
2642 @param value: the non-zero of the variable
2643 @param nlflag: flag to set whether the variable belongs to a non-linear term
2644 @param slackstatus: initial status of the slack variables, see IniStat
2645
2646 |
2647
2648 *Overload 4:*
2649 adds a constraint to the problem. The matrix non-zeros are added based on the supplied variables
2650
2651
2652 @ingroup DEFINE_MODEL_PYTHON
2653
2654 @param constype: the type of constraint, 0: ==, 1: >=, 2: <=, 3: free
2655 @param rhs: the right hand side
2656 @param varindex: the variables this constraint has non-zero coefficients
2657 @param value: the non-zero of the variable
2658 @param nlflag: flag to set whether the variable belongs to a non-linear term
2659 @param slackstatus: initial status of the slack variables, see IniStat
2660 """
2661 return libconopt4_python.ModelData_addConstraint(self, *args)
2662
2663 def addVariable(self, *args):
2664 r"""
2665 *Overload 1:*
2666 adds a variable to the model. The non-zero coefficients are added later.
2667
2668
2669 @ingroup DEFINE_MODEL_PYTHON
2670
2671 @param lower: lower bound for the variable
2672 @param upper: upper bound for the variable
2673 @param curr: initial value of the variable, can be set to 0
2674 @param varstatus: initial status of the variable, see IniStat
2675
2676 |
2677
2678 *Overload 2:*
2679 adds a variable to the model. The non-zero coefficients are added later.
2680
2681
2682 @ingroup DEFINE_MODEL_PYTHON
2683
2684 @param lower: lower bound for the variable
2685 @param upper: upper bound for the variable
2686 @param curr: initial value of the variable, can be set to 0
2687 @param varstatus: initial status of the variable, see IniStat
2688
2689 |
2690
2691 *Overload 3:*
2692 adds a variable to the model. The non-zero coefficients are added later.
2693
2694
2695 @ingroup DEFINE_MODEL_PYTHON
2696
2697 @param lower: lower bound for the variable
2698 @param upper: upper bound for the variable
2699 @param curr: initial value of the variable, can be set to 0
2700 @param varstatus: initial status of the variable, see IniStat
2701
2702 |
2703
2704 *Overload 4:*
2705 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
2706
2707
2708 @ingroup DEFINE_MODEL_PYTHON
2709
2710 @param lower: lower bound for the variable
2711 @param upper: upper bound for the variable
2712 @param consindex: the constraints this variable has non-zero coefficients
2713 @param value: the non-zero of the variable
2714 @param nlflag: flag to set whether the variable belongs to a non-linear term
2715 @param curr: initial value of the variable, can be set to 0
2716 @param varstatus: initial status of the variable, see IniStat
2717
2718 |
2719
2720 *Overload 5:*
2721 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
2722
2723
2724 @ingroup DEFINE_MODEL_PYTHON
2725
2726 @param lower: lower bound for the variable
2727 @param upper: upper bound for the variable
2728 @param consindex: the constraints this variable has non-zero coefficients
2729 @param value: the non-zero of the variable
2730 @param nlflag: flag to set whether the variable belongs to a non-linear term
2731 @param curr: initial value of the variable, can be set to 0
2732 @param varstatus: initial status of the variable, see IniStat
2733
2734 |
2735
2736 *Overload 6:*
2737 adds a variable to the problem. The matrix non-zeros are added based on the supplied constraints.
2738
2739
2740 @ingroup DEFINE_MODEL_PYTHON
2741
2742 @param lower: lower bound for the variable
2743 @param upper: upper bound for the variable
2744 @param consindex: the constraints this variable has non-zero coefficients
2745 @param value: the non-zero of the variable
2746 @param nlflag: flag to set whether the variable belongs to a non-linear term
2747 @param curr: initial value of the variable, can be set to 0
2748 @param varstatus: initial status of the variable, see IniStat
2749 """
2750 return libconopt4_python.ModelData_addVariable(self, *args)
2751
2752 def setObjectiveElement(self, elem, elemindex):
2753 r"""
2754 sets the index for the objective variable or constraint
2755
2756
2757 @ingroup DEFINE_MODEL_PYTHON
2758 """
2759 return libconopt4_python.ModelData_setObjectiveElement(self, elem, elemindex)
2760
2761 def setOptimizationSense(self, sense):
2762 r"""
2763 sets the optimisation direction.
2764
2765
2766 @ingroup DEFINE_MODEL_PYTHON
2767 """
2768 return libconopt4_python.ModelData_setOptimizationSense(self, sense)
2769
2770 def setInitialStatusOption(self, inistat):
2771 r"""
2772 the setting to indicate how the initial status of the variables and slack variables will be handled.
2773
2774 The initial status is set in the addVariable() and addConstraint() methods, or in the readMatrix() method if the
2775 classical model input approach is used. By default, the value of inistat is 0, which means that the variable and
2776 slack status is ignored.
2777
2778 If inistat == 1:
2779 The variable status has the following behaviour:
2780 - 0: The variable is initialized non-basic (if curr = lower or curr = upper) or super-basic, and
2781 - 1: The variable is initialized basic
2782 The slack status has the following behaviour:
2783 - 0: The slack is initialized non-basic (if the constraint is binding in the initial point) or super-basic,
2784 - 1: The slack is initialized basic
2785
2786 If inistat == 2:
2787 The variable status has the following behaviour:
2788 - 0: The variable is initialized at lower bound
2789 - 1: The variable is initialized at upper bound
2790 - 2: The variable is initialized basic, and
2791 - 3: The variable is initialized superbasic.
2792 The slack status has the following behaviour:
2793 - 0: The slack is initialized at lower bound.
2794 - 1: The slack is initialized at upper bound.
2795 - 2: The slack is initialized basic, and
2796 - 3: The slack is initialized superbasic.
2797
2798
2799 @ingroup DEFINE_MODEL_PYTHON
2800 """
2801 return libconopt4_python.ModelData_setInitialStatusOption(self, inistat)
2802
2803 def numVar(self):
2804 r"""
2805 returns the number of variables in the model
2806
2807
2808 @ingroup QUERY_MODEL_PYTHON
2809 """
2810 return libconopt4_python.ModelData_numVar(self)
2811
2812 def numCons(self):
2813 r"""
2814 returns the number of constraints in the model
2815
2816
2817 @ingroup QUERY_MODEL_PYTHON
2818 """
2819 return libconopt4_python.ModelData_numCons(self)
2820
2821 def numHessianNonzeros(self):
2822 r"""
2823 returns the number of non-zeros in the Hessian
2824
2825
2826 @ingroup QUERY_MODEL_PYTHON
2827 """
2828 return libconopt4_python.ModelData_numHessianNonzeros(self)
2829
2830 def getVariable(self, index):
2831 r"""
2832 returns a reference to the variable object
2833
2834
2835 @ingroup QUERY_MODEL_PYTHON
2836 """
2837 return libconopt4_python.ModelData_getVariable(self, index)
2838
2839 def getConstraint(self, index):
2840 r"""
2841 returns a reference to the constraint object
2842
2843
2844 @ingroup QUERY_MODEL_PYTHON
2845 """
2846 return libconopt4_python.ModelData_getConstraint(self, index)
2847
2848 def setSDEvaluationType(self, sdevaltype):
2849 r"""
2850 informs CONOPT of the method for evaluating the second derivative
2851
2852
2853 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2854 """
2855 return libconopt4_python.ModelData_setSDEvaluationType(self, sdevaltype)
2856
2857 def setSDLagrangianStructure(self, rownum, colnum):
2858 r"""
2859 sets the structure of the second derivatives of the Lagrangian
2860
2861
2862 @ingroup DEFINE_SECOND_DERIVATIVE_PYTHON
2863
2864 @param rownum: Vector of row numbers of the lower triangular part of the Hessian.
2865 @param colnum: Vector of column numbers of the lower triangular part of the Hessian.
2866 """
2867 return libconopt4_python.ModelData_setSDLagrangianStructure(self, rownum, colnum)
2868 def __disown__(self):
2869 self.this.disown()
2870 libconopt4_python.disown_ModelData(self)
2871 return weakref.proxy(self)
2872
2873# Register ModelData in libconopt4_python:
2874libconopt4_python.ModelData_swigregister(ModelData)
2875
Proxy of C++ swig::SwigPyIterator class.
Definition pyconopt.py:66
__init__(self, *args, **kwargs)
Definition pyconopt.py:71
copy(self)
copy(SwigPyIterator self) -> SwigPyIterator
Definition pyconopt.py:124
value(self)
value(SwigPyIterator self) -> PyObject *
Definition pyconopt.py:76
distance(self, x)
distance(SwigPyIterator self, SwigPyIterator x) -> ptrdiff_t
Definition pyconopt.py:102
incr(self, n=1)
incr(SwigPyIterator self, size_t n=1) -> SwigPyIterator
Definition pyconopt.py:80
decr(self, n=1)
decr(SwigPyIterator self, size_t n=1) -> SwigPyIterator
Definition pyconopt.py:91
equal(self, x)
equal(SwigPyIterator self, SwigPyIterator x) -> bool
Definition pyconopt.py:113
Meta class to enforce nondynamic attributes (no new attributes) for a class.
Definition pyconopt.py:59
_swig_repr(self)
Definition pyconopt.py:22
_swig_setattr_nondynamic_class_variable(set)
Definition pyconopt.py:43
_swig_setattr_nondynamic_instance_variable(set)
Definition pyconopt.py:30
_swig_add_metaclass(metaclass)
Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six....
Definition pyconopt.py:52