-
Notifications
You must be signed in to change notification settings - Fork 30
/
api.jl
4956 lines (3665 loc) · 265 KB
/
api.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""
int XPRS_CC XPRScopycallbacks(XPRSprob dest, XPRSprob src);
Copies callback functions defined for one problem to another.
### Arguments
- `dest`: The problem to which the callbacks are copied.
- `src`: The problem from which the callbacks are copied.
"""
function copycallbacks(dest::XpressProblem, src::XpressProblem)
@checked Lib.XPRScopycallbacks(dest, src)
end
"""
int XPRS_CC XPRScopycontrols(XPRSprob dest, XPRSprob src);
Copies controls defined for one problem to another.
### Arguments
- `dest`: The problem to which the controls are copied.
- `src`: The problem from which the controls are copied.
"""
function copycontrols(dest::XpressProblem, src::XpressProblem)
@checked Lib.XPRScopycontrols(dest, src)
return dest
end
"""
int XPRS_CC XPRScopyprob(XPRSprob dest, XPRSprob src, const char *probname);
Copies information defined for one problem to another.
### Arguments
- `dest`: The new problem pointer to which information is copied.
- `src`: The old problem pointer from which information is copied.
- `probname`: A string of up to 1024 characters (including `NULL` terminator) containing the name for the problem copy. This must be unique when file writing is to be expected, and particularly for global problems.
"""
function copyprob(dest::XpressProblem, src::XpressProblem, probname="")
@checked Lib.XPRScopyprob(dest, src, probname)
return dest
end
"""
int XPRS_CC XPRScreateprob(XPRSprob *prob);
Sets up a new problem within the Optimizer.
"""
function createprob(_probholder)
@checked Lib.XPRScreateprob(_probholder)
end
"""
int XPRS_CC XPRSdestroyprob(XPRSprob prob);
Removes a given problem and frees any memory associated with it following manipulation and optimization.
"""
function destroyprob(prob::XpressProblem)
@checked Lib.XPRSdestroyprob(prob)
end
"""
int XPRS_CC XPRSinit(const char *xpress);
Initializes the Optimizer library. This must be called before any other library routines.
"""
function init()
@checked Lib.XPRSinit(C_NULL)
end
"""
int XPRS_CC XPRSfree(void);
Frees any allocated memory and closes all open files.
"""
function free()
@checked Lib.XPRSfree()
end
"""
int XPRS_CC XPRSgetbanner(char *banner);
Returns the banner and copyright message.
"""
function getbanner()
banner = @invoke Lib.XPRSgetbanner(_)::String
return banner
end
"""
int XPRS_CC XPRSgetversion(char *version);
Returns the full Optimizer version number in the form 15.10.03, where 15 is the major release, 10 is the minor release, and 03 is the build number.
"""
function getversion()
version = @invoke Lib.XPRSgetversion(_)::String
return VersionNumber(parse.(Int, split(version, "."))...)
end
"""
int XPRS_CC XPRSgetdaysleft(int *days);
Returns the number of days left until an evaluation license expires.
"""
function getdaysleft()
daysleft = @invoke Lib.XPRSgetdaysleft(_)::Int
end
"""
int XPRS_CC XPRSsetcheckedmode(int checked_mode);
You can use this function to disable some of the checking and validation of function calls and function call parameters for calls to the Xpress Optimizer API. This checking is relatively lightweight but disabling it can improve performance in cases where non-intensive Xpress Optimizer functions are called repeatedly in a short space of time. Please note: after disabling function call checking and validation, invalid usage of Xpress Optimizer functions may not be detected and may cause the Xpress Optimizer process to behave unexpectedly or crash. It is not recommended that you disable function call checking and validation during application development.
"""
function setcheckedmode(checked_mode)
@checked Lib.XPRSsetcheckedmode(checked_mode)
end
"""
int XPRS_CC XPRSgetcheckedmode(int* r_checked_mode);
You can use this function to interrogate whether checking and validation of all Optimizer function calls is enabled for the current process. Checking and validation is enabled by default but can be disabled by XPRSsetcheckedmode.
"""
function getcheckedmode(r_checked_mode)
@checked Lib.XPRSgetcheckedmode(r_checked_mode)
end
function license(lic, path)
r = Lib.XPRSlicense(lic, path)
end
function beginlicensing(r_dontAlreadyHaveLicense)
@checked Lib.XPRSbeginlicensing(r_dontAlreadyHaveLicense)
end
function endlicensing()
@checked Lib.XPRSendlicensing()
end
"""
int XPRS_CC XPRSgetlicerrmsg(char *buffer, int length);
Retrieves an error message describing the last licensing error, if any occurred.
### Arguments
- `buffer`: Buffer long enough to hold the error message (plus a null terminator).
- `length`: Length of the buffer. This should be 512 or more since messages can be quite long.
"""
function getlicerrmsg(; len = 1024)
msg = Cstring(pointer(Array{Cchar}(undef, len*8)))
Lib.XPRSgetlicerrmsg(msg, len)
# TODO - @ checked version does not work
# @checked Lib.XPRSgetlicerrmsg(msg, len)
return unsafe_string(msg)
end
"""
int XPRS_CC XPRSsetlogfile(XPRSprob prob, const char *filename);
This directs all Optimizer output to a log file.
### Arguments
- `prob`: The current problem.
- `filename`: A string of up to MAXPROBNAMELENGTH characters containing the file name to which all logging output should be written. If set to `NULL` , redirection of the output will stop and all screen output will be turned back on (except for DLL users where screen output is always turned off).
"""
function setlogfile(prob::XpressProblem, logname::Union{String, Ptr{Nothing}})
@checked Lib.XPRSsetlogfile(prob, logname)
end
"""
int XPRS_CC XPRSsetintcontrol(XPRSprob prob, int ipar, int isval);
Sets the value of a given integer control parameter.
- `prob`: The current problem.
- `ipar`: Control parameter whose value is to be set. A full list of all controls may be found in _Control Parameters_ , or from the list in the `xprs.h` header file.
- `isval`: Value to which the control parameter is to be set.
"""
function setintcontrol(prob::XpressProblem, _index::Integer, _ivalue::Integer)
@checked Lib.XPRSsetintcontrol(prob, Cint(_index), _ivalue)
end
# # Disable 64Bit versions do to reliability issues.
# function setintcontrol(prob::XpressProblem, _index::Int64, _ivalue::Integer)
# @checked Lib.XPRSsetintcontrol64(prob, _index, _ivalue)
# end
"""
int XPRS_CC XPRSsetdblcontrol(XPRSprob prob, int ipar, double dsval);
Sets the value of a given double control parameter.
### Arguments
- `prob`: The current problem.
- `ipar`: Control parameter whose value is to be set. A full list of all controls may be found in _Control Parameters_ , or from the list in the `xprs.h` header file.
- `dsval`: Value to which the control parameter is to be set.
"""
function setdblcontrol(prob::XpressProblem, _index::Integer, _dvalue::AbstractFloat)
@checked Lib.XPRSsetdblcontrol(prob, _index, _dvalue)
end
"""
int XPRS_CC XPRSinterrupt(XPRSprob prob, int reason);
Interrupts the Optimizer algorithms.
### Arguments
- `prob`: The current problem.
- `reason`: The reason for stopping. Possible reasons are:`XPRS_STOP_TIMELIMIT`: time limit hit;`XPRS_STOP_CTRLC`: control C hit;`XPRS_STOP_NODELIMIT`: node limit hit;`XPRS_STOP_ITERLIMIT`: iteration limit hit;`XPRS_STOP_MIPGAP`: MIP gap is sufficiently small;`XPRS_STOP_SOLLIMIT`: solution limit hit;`XPRS_STOP_USER`: user interrupt.
"""
function interrupt(prob::XpressProblem, reason)
@checked Lib.XPRSinterrupt(prob, reason)
end
"""
int XPRS_CC XPRSgetprobname(XPRSprob prob, char *probname);
Returns the current problem name.
### Arguments
- `prob`: The current problem.
- `probname`: A string of up to MAXPROBNAMELENGTH characters to contain the current problem name.
"""
function getprobname(prob::XpressProblem)
@invoke Lib.XPRSgetprobname(prob, _)::String
end
"""
int XPRS_CC XPRSgetqobj(XPRSprob prob, int icol, int jcol, double *dval);
Returns a single quadratic objective function coefficient corresponding to the variable pair `(icol, jcol)` of the Hessian matrix.
### Arguments
- `prob`: The current problem.
- `icol`: Column index for the first variable in the quadratic term.
- `jcol`: Column index for the second variable in the quadratic term.
- `dval`: Pointer to a double value where the objective function coefficient is to be placed.
"""
function getqobj(prob::XpressProblem, _icol, _jcol, _dval)
@checked Lib.XPRSgetqobj(prob, _icol, _jcol, _dval)
end
"""
int XPRS_CC XPRSsetprobname(XPRSprob prob, const char *probname);
Sets the current default problem name. This command is rarely used.
### Arguments
- `prob`: The current problem.
- `probname`: A string of up to MAXPROBNAMELENGTH characters containing the problem name.
"""
function setprobname(prob::XpressProblem, name::AbstractString)
@checked Lib.XPRSsetprobname(prob, name)
end
"""
int XPRS_CC XPRSsetstrcontrol(XPRSprob prob, int ipar, const char *csval);
Used to set the value of a given string control parameter.
### Arguments
- `prob`: The current problem.
- `ipar`: Control parameter whose value is to be set. A full list of all controls may be found in _Control Parameters_ , or from the list in the `xprs.h` header file.
- `csval`: A string containing the value to which the control is to be set (plus a null terminator).
"""
function setstrcontrol(prob::XpressProblem, _index::Integer)
@invoke Lib.XPRSsetstrcontrol(prob, _index, _)::String
end
"""
int XPRS_CC XPRSgetintcontrol(XPRSprob prob, int ipar, int *igval);
Enables users to recover the values of various integer control parameters
### Arguments
- `prob`: The current problem.
- `ipar`: Control parameter whose value is to be returned. A full list of all controls may be found in Chapter _Control Parameters_ , or from the list in the `xprs.h` header file.
- `igval`: Pointer to an integer where the value of the control will be returned.
"""
function getintcontrol(prob::XpressProblem, _index::Integer)
_index = Int32(_index)
@invoke Lib.XPRSgetintcontrol(prob, _index, _)::Int
end
function getintcontrol64(prob::XpressProblem, _index::Integer)
_index = Int32(_index)
@invoke Lib.XPRSgetintcontrol64(prob, _index, _)::Int
end
"""
int XPRS_CC XPRSgetdblcontrol(XPRSprob prob, int ipar, double *dgval);
Retrieves the value of a given double control parameter.
### Arguments
- `prob`: The current problem.
- `ipar`: Control parameter whose value is to be returned. A full list of all controls may be found in Chapter _Control Parameters_ , or from the list in the `xprs.h` header file.
- `dgval`: Pointer to the location where the control value will be returned.
"""
function getdblcontrol(prob::XpressProblem, _index::Integer)
@invoke Lib.XPRSgetdblcontrol(prob, _index, _)::Float64
end
"""
int XPRS_CC XPRSgetstrcontrol(XPRSprob prob, int ipar, char *cgval);
Returns the value of a given string control parameters.
### Arguments
- `prob`: The current problem.
- `ipar`: Control parameter whose value is to be returned. A full list of all controls may be found in _Control Parameters_ , or from the list in the `xprs.h` header file.
- `cgval`: Pointer to a string where the value of the control (plus null terminator) will be returned.
- `cgvalsize`: Maximum number of bytes to be written into the cgval argument.
- `controlsize`: Returns the length of the string control including the null terminator.
"""
function getstrcontrol(prob::XpressProblem, _index::Integer)
@invoke Lib.XPRSgetstrcontrol(prob, _index, _)::String
end
function getstringcontrol(prob::XpressProblem, _index::Integer, _svalue, _svaluesize, _controlsize)
@checked Lib.XPRSgetstringcontrol(prob, _index, _svalue, _svaluesize, _controlsize)
end
"""
int XPRS_CC XPRSgetintattrib(XPRSprob prob, int ipar, int *ival);
Enables users to recover the values of various integer problem attributes. Problem attributes are set during loading and optimization of a problem.
### Arguments
- `prob`: The current problem.
- `ipar`: Problem attribute whose value is to be returned. A full list of all problem attributes may be found in Chapter _Problem Attributes_ , or from the list in the `xprs.h` header file.
- `ival`: Pointer to an integer where the value of the problem attribute will be returned.
"""
function getintattrib(prob::XpressProblem, _index::Integer)
@invoke Lib.XPRSgetintattrib(prob, _index, _)::Int
end
function getintattrib64(prob::XpressProblem, _index::Integer)
@invoke Lib.XPRSgetintattrib64(prob, _index, _)::Int
end
"""
int XPRS_CC XPRSgetstrattrib(XPRSprob prob, int ipar, char *cval);
Enables users to recover the values of various string problem attributes. Problem attributes are set during loading and optimization of a problem.
### Arguments
- `prob`: The current problem.
- `ipar`: Problem attribute whose value is to be returned. A full list of all problem attributes may be found in _Problem Attributes_ , or from the list in the `xprs.h` header file.
- `cval`: Pointer to a string where the value of the attribute (plus null terminator) will be returned.
- `cgvalsize`: Maximum number of bytes to be written into the cgval argument.
- `controlsize`: Returns the length of the string control including the null terminator.
"""
function getstrattrib(prob::XpressProblem, _index::Integer)
@invoke Lib.XPRSgetstrattrib(prob, _index, _)::String
end
function getstringattrib(prob::XpressProblem, _index::Integer, _cvalue, _cvaluesize, _controlsize)
@checked Lib.XPRSgetstringattrib(prob, _index, _cvalue, _cvaluesize, _controlsize)
end
"""
int XPRS_CC XPRSgetdblattrib(XPRSprob prob, int ipar, double *dval);
Enables users to retrieve the values of various double problem attributes. Problem attributes are set during loading and optimization of a problem.
### Arguments
- `prob`: The current problem.
- `ipar`: Problem attribute whose value is to be returned. A full list of all available problem attributes may be found in Chapter _Problem Attributes_ , or from the list in the `xprs.h` header file.
- `dval`: Pointer to a double where the value of the problem attribute will be returned.
"""
function getdblattrib(prob::XpressProblem, _index::Integer)
@invoke Lib.XPRSgetdblattrib(prob, _index, _)::Float64
end
"""
int XPRS_CC XPRSsetdefaultcontrol(XPRSprob prob, int ipar);
Sets a single control to its default value.
### Arguments
- `prob`: The current problem.
- `ipar`: Integer, double or string control parameter whose default value is to be set.
- `controlname`: Integer, double or string control parameter whose default value is to be set.
"""
function setdefaultcontrol(prob::XpressProblem, _index::Integer)
@checked Lib.XPRSsetdefaultcontrol(prob, _index)
end
"""
int XPRS_CC XPRSsetdefaults(XPRSprob prob);
Sets all controls to their default values. Must be called before the problem is read or loaded by XPRSreadprob, XPRSloadglobal, XPRSloadlp, XPRSloadqglobal, XPRSloadqp.
"""
function setdefaults(prob::XpressProblem)
@checked Lib.XPRSsetdefaults(prob)
end
"""
int XPRS_CC XPRSgetcontrolinfo(XPRSprob prob, const char* sCaName, int* iHeaderId, int* iTypeinfo);
Accesses the id number and the type information of a control given its name. A control name may be for example `XPRS_PRESOLVE`. Names are case-insensitive and may or may not have the `XPRS_` prefix. The id number is the constant used to identify the control for calls to functions such as XPRSgetintcontrol. The function will return an id number of `0` and a type value of `XPRS_TYPE_NOTDEFINED` if the name is not recognized as a control name. Note that this will occur if the name is an attribute name and not a control name. The type information returned will be one of the below integer constants defined in the `xprs.h` header file. `XPRS_TYPE_NOTDEFINED`: The name was not recognized.`XPRS_TYPE_INT`: 32 bit integer.`XPRS_TYPE_INT64`: 64 bit integer.`XPRS_TYPE_DOUBLE`: Double precision floating point.`XPRS_TYPE_STRING`: String.
### Arguments
- `prob`: The current problem.
- `sCaName`: The name of the control to be queried. Names are case-insensitive and may or may not have the `XPRS_` prefix. A full list of all controls may be found in _Control Parameters_ , or from the list in the `xprs.h` header file.
- `iHeaderId`: Pointer to an integer where the id number will be returned.
- `iTypeInfo`: Pointer to an integer where the type information will be returned.
"""
function getcontrolinfo(prob::XpressProblem, sCaName, iHeaderId, iTypeinfo)
@checked Lib.XPRSgetcontrolinfo(prob, sCaName, iHeaderId, iTypeinfo)
end
"""
int XPRS_CC XPRSgetattribinfo(XPRSprob prob, const char* sCaName, int* iHeaderId, int* iTypeinfo);
Accesses the id number and the type information of an attribute given its name. An attribute name may be for example `XPRS_ROWS`. Names are case-insensitive and may or may not have the `XPRS_` prefix. The id number is the constant used to identify the attribute for calls to functions such as XPRSgetintattrib. The type information returned will be one of the below integer constants defined in the `xprs.h` header file. The function will return an id number of 0 and a type value of `XPRS_TYPE_NOTDEFINED` if the name is not recognized as an attribute name. Note that this will occur if the name is a control name and not an attribute name. `XPRS_TYPE_NOTDEFINED`: The name was not recognized.`XPRS_TYPE_INT`: 32 bit integer.`XPRS_TYPE_INT64`: 64 bit integer.`XPRS_TYPE_DOUBLE`: Double precision floating point.`XPRS_TYPE_STRING`: String.
### Arguments
- `prob`: The current problem.
- `sCaName`: The name of the attribute to be queried. Names are case-insensitive and may or may not have the `XPRS_` prefix. A full list of all attributes may be found in Chapter _Control Parameters_ , or from the list in the `xprs.h` header file.
- `iHeaderId`: Pointer to an integer where the id number will be returned.
- `iTypeInfo`: Pointer to an integer where the type id will be returned.
"""
function getattribinfo(prob::XpressProblem, sCaName, iHeaderId, iTypeinfo)
@checked Lib.XPRSgetattribinfo(prob, sCaName, iHeaderId, iTypeinfo)
end
"""
int XPRS_CC XPRSgoal(XPRSprob prob, const char *filename, const char *flags);
This function is deprecated, and will be removed in future releases. Perform goal programming.
### Arguments
- `prob`: The current problem.
- `filename`: A string of up to MAXPROBNAMELENGTH characters containing the file name from which the directives are to be read (a `.gol` extension will be added).
- `flags`: Flags to pass to `XPRSgoal` ( `GOAL` ):`o`: optimization process logs to be displayed;`l`: treat integer variables as linear;`f`: write output into a file `filename.grp` .
"""
function goal(prob::XpressProblem, _filename::String, _sflags::String="")
@checked Lib.XPRSgoal(prob, _filename, _sflags)
end
"""
int XPRS_CC XPRSreadprob(XPRSprob prob, const char *probname, const char *flags);
Reads an (X)MPS or LP format matrix from file.
### Arguments
- `prob`: The current problem.
- `probname`: The path and file name from which the problem is to be read. Limited to MAXPROBNAMELENGTH characters. If omitted (console users only), the default _problem_name_ is used with various extensions - see below.
- `flags`: Flags to be passed:`l`: only `probname.lp` is searched for;`z`: read input file in gzip format from a `.gz` file [ Console only ]
"""
function readprob(prob::XpressProblem, _sprobname::String, _sflags::String="")
@checked Lib.XPRSreadprob(prob, _sprobname, _sflags)
end
"""
int XPRS_CC XPRSloadlp(XPRSprob prob, const char *probname, int ncol, int nrow, const char qrtype[], const double rhs[], const double range[], const double obj[], const int mstart[], const int mnel[], const int mrwind[], const double dmatval[], const double dlb[], const double dub[]);
Enables the user to pass a matrix directly to the Optimizer, rather than reading the matrix from a file.
### Arguments
- `prob`: The current problem.
- `probname`: A string of up to MAXPROBNAMELENGTH characters containing a names for the problem.
- `ncol`: Number of structural columns in the matrix.
- `nrow`: Number of rows in the matrix (not including the objective). Objective coefficients must be supplied in the `obj` array, and the objective function should not be included in any of the other arrays.
- `qrtype`: Character array of length `nrow` containing the row types:`L`: indicates a ≤ constraint;`E`: indicates an = constraint;`G`: indicates a ≥ constraint;`R`: indicates a range constraint;`N`: indicates a nonbinding constraint.
- `rhs`: Double array of length `nrow` containing the right hand side coefficients of the rows. The right hand side value for a range row gives the *upper* bound on the row.
- `range`: Double array of length `nrow` containing the range values for range rows. Values for all other rows will be ignored. May be `NULL` if not required. The lower bound on a range row is the right hand side value minus the range value. The sign of the range value is ignored - the absolute value is used in all cases.
- `obj`: Double array of length `ncol` containing the objective function coefficients.
- `mstart`: Integer array containing the offsets in the `mrwind` and `dmatval` arrays of the start of the elements for each column. This array is of length `ncol` or, if `mnel` is `NULL` , length `ncol+1` . If `mnel` is `NULL` , the extra entry of `mstart` , `mstart[ncol]` , contains the position in the `mrwind` and `dmatval` arrays at which an extra column would start, if it were present. In C, this value is also the length of the `mrwind` and `dmatval` arrays.
- `mnel`: Integer array of length `ncol` containing the number of nonzero elements in each column. May be `NULL` if not required. This array is not required if the non-zero coefficients in the `mrwind` and `dmatval` arrays are continuous, and the `mstart` array has `ncol+1` entries as described above.
- `mrwind`: Integer array containing the row indices for the nonzero elements in each column. If the indices are input contiguously, with the columns in ascending order, the length of the `mrwind` is `mstart[ncol-1]+mnel[ncol-1]` or, if `mnel` is `NULL` , `mstart[ncol]` .
- `dmatval`: Double array containing the nonzero element values; length as for `mrwind` .
- `dlb`: Double array of length `ncol` containing the lower bounds on the columns. Use `XPRS_MINUSINFINITY` to represent a lower bound of minus infinity.
- `dub`: Double array of length `ncol` containing the upper bounds on the columns. Use `XPRS_PLUSINFINITY` to represent an upper bound of plus infinity.
"""
function loadlp(prob::XpressProblem, _sprobname="", ncols=0, nrows=0, _srowtypes=Cchar[], _drhs=Float64[], _drange=Float64[], _dobj=Float64[], _mstart=Int[], _mnel=Int[], _mrwind=Int[], _dmatval=Float64[], _dlb=Float64[], _dub=Float64[])
@checked Lib.XPRSloadlp(prob, _sprobname, ncols, nrows, _srowtypes, _drhs, _drange, _dobj, _mstart, _mnel, _mrwind, _dmatval, _dlb, _dub)
end
function loadlp64(prob::XpressProblem, _sprobname="", ncols=0, nrows=0, _srowtypes=Cchar[], _drhs=Float64[], _drange=Float64[], _dobj=Float64[], _mstart=Int[], _mnel=Int[], _mrwind=Int[], _dmatval=Float64[], _dlb=Float64[], _dub=Float64[])
@checked Lib.XPRSloadlp64(prob, _sprobname, ncols, nrows, _srowtypes, _drhs, _drange, _dobj, _mstart, _mnel, _mrwind, _dmatval, _dlb, _dub)
end
"""
int XPRS_CC XPRSloadqp(XPRSprob prob, const char *probname, int ncol, int nrow, const char qrtype[], const double rhs[], const double range[], const double obj[], const int mstart[], const int mnel[], const int mrwind[], const double dmatval[], const double dlb[], const double dub[], int nqtr, const int mqc1[], const int mqc2[], const double dqe[]);
Used to load a quadratic problem into the Optimizer data structure. Such a problem may have quadratic terms in its objective function, although not in its constraints.
### Arguments
- `prob`: The current problem.
- `probname`: A string of up to MAXPROBNAMELENGTH characters containing a names for the problem.
- `ncol`: Number of structural columns in the matrix.
- `nrow`: Number of rows in the matrix (not including the objective row). Objective coefficients must be supplied in the `obj` array, and the objective function should not be included in any of the other arrays.
- `qrtype`: Character array of length `nrow` containing the row types:`L`: indicates a ≤ constraint;`E`: indicates an = constraint;`G`: indicates a ≥ constraint;`R`: indicates a range constraint;`N`: indicates a nonbinding constraint.
- `rhs`: Double array of length `nrow` containing the right hand side coefficients of the rows. The right hand side value for a range row gives the *upper* bound on the row.
- `range`: Double array of length `nrow` containing the range values for range rows. Values for all other rows will be ignored. May be `NULL` if there are no ranged constraints. The lower bound on a range row is the right hand side value minus the range value. The sign of the range value is ignored - the absolute value is used in all cases.
- `obj`: Double array of length `ncol` containing the objective function coefficients.
- `mstart`: Integer array containing the offsets in the `mrwind` and `dmatval` arrays of the start of the elements for each column. This array is of length `ncol` or, if `mnel` is `NULL` , length `ncol+1` . If `mnel` is `NULL` the extra entry of `mstart` , `mstart[ncol]` , contains the position in the `mrwind` and `dmatval` arrays at which an extra column would start, if it were present. In C, this value is also the length of the `mrwind` and `dmatval` arrays.
- `mnel`: Integer array of length `ncol` containing the number of nonzero elements in each column. May be `NULL` if all elements are contiguous and `mstart[ncol]` contains the offset where the elements for column `ncol+1` would start. This array is not required if the non-zero coefficients in the `mrwind` and `dmatval` arrays are continuous, and the `mstart` array has `ncol+1` entries as described above. It may be `NULL` if not required.
- `mrwind`: Integer array containing the row indices for the nonzero elements in each column. If the indices are input contiguously, with the columns in ascending order, the length of the `mrwind` is `mstart[ncol-1]+mnel[ncol-1]` or, if `mnel` is `NULL` , `mstart[ncol]` .
- `dmatval`: Double array containing the nonzero element values; length as for `mrwind` .
- `dlb`: Double array of length `ncol` containing the lower bounds on the columns. Use `XPRS_MINUSINFINITY` to represent a lower bound of minus infinity.
- `dub`: Double array of length `ncol` containing the upper bounds on the columns. Use `XPRS_PLUSINFINITY` to represent an upper bound of plus infinity.
- `nqtr`: Number of quadratic terms.
- `mqc1`: Integer array of size `nqtr` containing the column index of the first variable in each quadratic term.
- `mqc2`: Integer array of size `nqtr` containing the column index of the second variable in each quadratic term.
- `dqe`: Double array of size `nqtr` containing the quadratic coefficients.
"""
function loadqp(prob::XpressProblem, _sprobname, ncols, nrows, _srowtypes, _drhs, _drange, _dobj, _mstart, _mnel, _mrwind, _dmatval, _dlb, _dub, nquads, _mqcol1, _mqcol2, _dqval)
@checked Lib.XPRSloadqp(prob, _sprobname, ncols, nrows, _srowtypes, _drhs, _drange, _dobj, _mstart, _mnel, _mrwind, _dmatval, _dlb, _dub, nquads, _mqcol1, _mqcol2, _dqval)
end
function loadqp64(prob::XpressProblem, _sprobname, ncols, nrows, _srowtypes, _drhs, _drange, _dobj, _mstart, _mnel, _mrwind, _dmatval, _dlb, _dub, nquads, _mqcol1, _mqcol2, _dqval)
@checked Lib.XPRSloadqp64(prob, _sprobname, ncols, nrows, _srowtypes, _drhs, _drange, _dobj, _mstart, _mnel, _mrwind, _dmatval, _dlb, _dub, nquads, _mqcol1, _mqcol2, _dqval)
end
"""
int XPRS_CC XPRSloadqglobal(XPRSprob prob, const char *probname, int ncol, int nrow, const char qrtype[], const double rhs[], const double range[], const double obj[], const int mstart[], const int mnel[], const int mrwind[], const double dmatval[], const double dlb[], const double dub[], int nqtr, const int mqc1[], const int mqc2[], const double dqe[], const int ngents, const int nsets, const char qgtype[], const int mgcols[], const double dlim[], const char qstype[], const int msstart[], const int mscols[], const double dref[]);
Used to load a global problem with quadratic objective coefficients in to the Optimizer data structures. Integer, binary, partial integer, semi-continuous and semi-continuous integer variables can be defined, together with sets of type 1 and 2. The reference row values for the set members are passed as an array rather than specifying a reference row.
### Arguments
- `prob`: The current problem.
- `probname`: A string of up to MAXPROBNAMELENGTH characters containing a name for the problem.
- `ncol`: Number of structural columns in the matrix.
- `nrow`: Number of rows in the matrix (not including the objective). Objective coefficients must be supplied in the `obj` array, and the objective function should not be included in any of the other arrays.
- `qrtype`: Character array of length `nrow` containing the row type:`L`: indicates a ≤ constraint;`E`: indicates an = constraint;`G`: indicates a ≥ constraint;`R`: indicates a range constraint;`N`: indicates a nonbinding constraint.
- `rhs`: Double array of length `nrow` containing the right hand side coefficients. The right hand side value for a range row gives the *upper* bound on the row.
- `range`: Double array of length `nrow` containing the range values for range rows. The values in the range array will only be read for `R` type rows. The entries for other type rows will be ignored. May be `NULL` if not required. The lower bound on a range row is the right hand side value minus the range value. The sign of the range value is ignored - the absolute value is used in all cases.
- `obj`: Double array of length `ncol` containing the objective function coefficients.
- `mstart`: Integer array containing the offsets in the `mrwind` and `dmatval` arrays of the start of the elements for each column. This array is of length `ncol` or, if `mnel` is `NULL` , length `ncol+1` .
- `mnel`: Integer array of length `ncol` containing the number of nonzero elements in each column. May be `NULL` if not required. This array is not required if the non-zero coefficients in the `mrwind` and `dmatval` arrays are continuous, and the `mstart` array has `ncol+1` entries as described above. It may be `NULL` if not required.
- `mrwind`: Integer arrays containing the row indices for the nonzero elements in each column. If the indices are input contiguously, with the columns in ascending order, then the length of `mrwind` is `mstart[ncol-1]+mnel[ncol-1]` or, if `mnel` is `NULL` , `mstart[ncol]` .
- `dmatval`: Double array containing the nonzero element values length as for `mrwind` .
- `dlb`: Double array of length `ncol` containing the lower bounds on the columns. Use `XPRS_MINUSINFINITY` to represent a lower bound of minus infinity.
- `dub`: Double array of length `ncol` containing the upper bounds on the columns. Use `XPRS_PLUSINFINITY` to represent an upper bound of plus infinity.
- `nqtr`: Number of quadratic terms.
- `mqc1`: Integer array of size `nqtr` containing the column index of the first variable in each quadratic term.
- `mqc2`: Integer array of size `nqtr` containing the column index of the second variable in each quadratic term.
- `dqe`: Double array of size `nqtr` containing the quadratic coefficients.
- `ngents`: Number of binary, integer, semi-continuous, semi-continuous integer and partial integer entities.
- `nsets`: Number of SOS1 and SOS2 sets.
- `qgtype`: Character array of length `ngents` containing the entity types:`B`: binary variables;`I`: integer variables;`P`: partial integer variables;`S`: semi-continuous variables;`R`: semi-continuous integers.
- `mgcols`: Integer array of length `ngents` containing the column indices of the global entities.
- `dlim`: Double array of length `ngents` containing the integer limits for the partial integer variables and lower bounds for semi-continuous and semi-continuous integer variables (any entries in the positions corresponding to binary and integer variables will be ignored). May be `NULL` if not required.
- `qstype`: Character array of length `nsets` containing:`1`: SOS1 type sets;`2`: SOS2 type sets.May be `NULL` if not required.
- `msstart`: Integer array containing the offsets in the `mscols` and `dref` arrays indicating the start of the sets. This array is of length `nsets+1` , the last member containing the offset where set `nsets+1` would start. May be `NULL` if not required.
- `mscols`: Integer array of length `msstart[nsets]-1` containing the columns in each set. May be `NULL` if not required.
- `dref`: Double array of length `msstart[nsets]-1` containing the reference row entries for each member of the sets. May be `NULL` if not required.
"""
function loadqglobal(prob::XpressProblem, probname, ncols, nrows, qsenx, rhsx, range, objx, matbeg, matcnt, matind, dmtval, bndl, bndu, nquads, mqcol1, mqcol2, dqval, ngents, nsets, qgtype, mgcols, dlim, qstype, msstart, mscols, dref)
@checked Lib.XPRSloadqglobal(prob, probname, ncols, nrows, qsenx, rhsx, range, objx, matbeg, matcnt, matind, dmtval, bndl, bndu, nquads, mqcol1, mqcol2, dqval, ngents, nsets, qgtype, mgcols, dlim, qstype, msstart, mscols, dref)
end
function loadqglobal64(prob::XpressProblem, probname, ncols, nrows, qsenx, rhsx, range, objx, matbeg, matcnt, matind, dmtval, bndl, bndu, nquads, mqcol1, mqcol2, dqval, ngents, nsets, qgtype, mgcols, dlim, qstype, msstart, mscols, dref)
@checked Lib.XPRSloadqglobal64(prob, probname, ncols, nrows, qsenx, rhsx, range, objx, matbeg, matcnt, matind, dmtval, bndl, bndu, nquads, mqcol1, mqcol2, dqval, ngents, nsets, qgtype, mgcols, dlim, qstype, msstart, mscols, dref)
end
"""
int XPRS_CC XPRSfixglobals(XPRSprob prob, int ifround);
Fixes all the global entities to the values of the last found MIP solution. This is useful for finding the reduced costs for the continuous variables after the global variables have been fixed to their optimal values.
### Arguments
- `prob`: The current problem.
- `ifround`: If all global entities should be rounded to the nearest discrete value in the solution before being fixed.
- `flags`: Flags to pass to FIXGLOBALS:`r`: round all global entities to the nearest feasible value in the solution before being fixed;
"""
function fixglobals(prob::XpressProblem, ifround::Bool)
@checked Lib.XPRSfixglobals(prob, ifround)
end
"""
int XPRS_CC XPRSloadmodelcuts(XPRSprob prob, int nmod, const int mrows[]);
Specifies that a set of rows in the matrix will be treated as model cuts.
### Arguments
- `prob`: The current problem.
- `nmod`: The number of model cuts.
- `mrows`: An array of row indices to be treated as cuts.
"""
function loadmodelcuts(prob::XpressProblem, nmodcuts, _mrows)
@checked Lib.XPRSloadmodelcuts(prob, nmodcuts, _mrows)
end
"""
int XPRS_CC XPRSloaddelayedrows(XPRSprob prob, int nrows, const int mrows[]);
Specifies that a set of rows in the matrix will be treated as delayed rows during a global search. These are rows that must be satisfied for any integer solution, but will not be loaded into the active set of constraints until required.
### Arguments
- `prob`: The current problem.
- `nrows`: The number of delayed rows.
- `mrows`: An array of row indices to treat as delayed rows.
"""
function loaddelayedrows(prob::XpressProblem, nrows, _mrows)
@checked Lib.XPRSloaddelayedrows(prob, nrows, _mrows)
end
"""
int XPRS_CC XPRSloaddirs(XPRSprob prob, int ndir, const int mcols[], const int mpri[], const char qbr[], const double dupc[], const double ddpc[]);
Loads directives into the matrix.
### Arguments
- `prob`: The current problem.
- `ndir`: Number of directives.
- `mcols`: Integer array of length `ndir` containing the column numbers. A negative value indicates a set number (the first set being `-1` , the second `-2` , and so on).
- `mpri`: Integer array of length `ndir` containing the priorities for the columns or sets. Priorities must be between 0 and 1000, where columns/sets with smallest priority will be branched on first. May be `NULL` if not required.
- `qbr`: Character array of length `ndir` specifying the branching direction for each column or set:`U`: the entity is to be forced up;`D`: the entity is to be forced down;`N`: not specified.May be `NULL` if not required.
- `dupc`: Double array of length `ndir` containing the up pseudo costs for the columns or sets. May be `NULL` if not required.
- `ddpc`: Double array of length `ndir` containing the down pseudo costs for the columns or sets. May be `NULL` if not required.
"""
function loaddirs(prob::XpressProblem, ndirs, _mcols, _mpri, _sbr, dupc, ddpc)
@checked Lib.XPRSloaddirs(prob, ndirs, _mcols, _mpri, _sbr, dupc, ddpc)
end
"""
int XPRS_CC XPRSloadbranchdirs(XPRSprob prob, int ndirs, const int mcols[], const int mbranch[]);
Loads directives into the current problem to specify which global entities the Optimizer should continue to branch on when a node solution is global feasible.
### Arguments
- `prob`: The current problem.
- `ndirs`: Number of directives.
- `mcols`: Integer array of length `ndirs` containing the column numbers. A negative value indicates a set number (the first set being -1, the second -2, and so on).
- `mbranch`: Integer array of length `ndirs` containing either 0 or 1 for the entities given in `mcols` . Entities for which mbranch is set to 1 will be branched on until fixed before a global feasible solution is returned. If `mbranch` is NULL, the branching directive will be set for all entities in `mcols` .
"""
function loadbranchdirs(prob::XpressProblem, ndirs, _mcols, _mbranch)
@checked Lib.XPRSloadbranchdirs(prob, ndirs, _mcols, _mbranch)
end
"""
int XPRS_CC XPRSloadpresolvedirs(XPRSprob prob, int ndir, const int mcols[], const int mpri[], const char qbr[], const double dupc[], const double ddpc[]);
Loads directives into the presolved matrix.
### Arguments
- `prob`: The current problem.
- `ndir`: Number of directives.
- `mcols`: Integer array of length `ndir` containing the column numbers. A negative value indicates a set number ( `-1` being the first set, `-2` the second, and so on).
- `mpri`: Integer array of length `ndir` containing the priorities for the columns or sets. May be `NULL` if not required.
- `qbr`: Character array of length `ndir` specifying the branching direction for each column or set:`U`: the entity is to be forced up;`D`: the entity is to be forced down;`N`: not specified.May be `NULL` if not required.
- `dupc`: Double array of length `ndir` containing the up pseudo costs for the columns or sets. May be `NULL` if not required.
- `ddpc`: Double array of length `ndir` containing the down pseudo costs for the columns or sets. May be `NULL` if not required.
"""
function loadpresolvedirs(prob::XpressProblem, ndirs, _mcols, _mpri, _sbr, dupc, ddpc)
@checked Lib.XPRSloadpresolvedirs(prob, ndirs, _mcols, _mpri, _sbr, dupc, ddpc)
end
"""
int XPRS_CC XPRSgetdirs(XPRSprob prob, int *ndir, int mcols[], int mpri[], char qbr[], double dupc[], double ddpc[]);
Used to return the directives that have been loaded into a matrix. Priorities, forced branching directions and pseudo costs can be returned. If called after presolve, `XPRSgetdirs` will get the directives for the presolved problem.
### Arguments
- `prob`: The current problem.
- `ndir`: Pointer to an integer where the number of directives will be returned.
- `mcols`: Integer array of length `ndir` containing the column numbers ( `0` , `1` , `2` ,...) or negative values corresponding to special ordered sets (the first set numbered `-1` , the second numbered `-2` ,...). May be NULL if not required.
- `mpri`: Integer array of length `ndir` containing the priorities for the columns and sets, where columns/sets with smallest priority will be branched on first. May be NULL if not required.
- `qbr`: Character array of length `ndir` specifying the branching direction for each column or set:`U`: the entity is to be forced up;`D`: the entity is to be forced down;`N`: not specified.
- `dupc`: Double array of length `ndir` containing the up pseudo costs for the columns and sets. May be NULL if not required.
- `ddpc`: Double array of length `ndir` containing the down pseudo costs for the columns and sets. May be NULL if not required.
"""
function getdirs(prob::XpressProblem, ndirs, _mcols, _mpri, _sbr, dupc, ddpc)
@checked Lib.XPRSgetdirs(prob, ndirs, _mcols, _mpri, _sbr, dupc, ddpc)
end
"""
int XPRS_CC XPRSloadglobal(XPRSprob prob, const char *probname, int ncol, int nrow, const char qrtype[], const double rhs[], const double range[], const double obj[], const int mstart[], const int mnel[], const int mrwind[], const double dmatval[], const double dlb[], const double dub[], int ngents, int nsets, const char qgtype[], const int mgcols[], const double dlim[], const char qstype[], const int msstart[], const int mscols[], const double dref[]);
Used to load a global problem in to the Optimizer data structures. Integer, binary, partial integer, semi-continuous and semi-continuous integer variables can be defined, together with sets of type 1 and 2. The reference row values for the set members are passed as an array rather than specifying a reference row.
### Arguments
- `prob`: The current problem.
- `probname`: A string of up to MAXPROBNAMELENGTH characters containing a name for the problem.
- `ncol`: Number of structural columns in the matrix.
- `nrow`: Number of rows in the matrix not (including the objective row). Objective coefficients must be supplied in the `obj` array, and the objective function should not be included in any of the other arrays.
- `qrtype`: Character array of length `nrow` containing the row types:`L`: indicates a ≤ constraint;`E`: indicates an = constraint;`G`: indicates a ≥ constraint;`R`: indicates a range constraint;`N`: indicates a nonbinding constraint.
- `rhs`: Double array of length `nrow` containing the right hand side coefficients. The right hand side value for a range row gives the *upper* bound on the row.
- `range`: Double array of length `nrow` containing the range values for range rows. Values for all other rows will be ignored. May be `NULL` if not required. The lower bound on a range row is the right hand side value minus the range value. The sign of the range value is ignored - the absolute value is used in all cases.
- `obj`: Double array of length `ncol` containing the objective function coefficients.
- `mstart`: Integer array containing the offsets in the `mrwind` and `dmatval` arrays of the start of the elements for each column. This array is of length `ncol` or, if `mnel` is `NULL` , length `ncol+1` . If `mnel` is `NULL` , the extra entry of `mstart` , `mstart[ncol]` , contains the position in the `mrwind` and `dmatval` arrays at which an extra column would start, if it were present. In C, this value is also the length of the `mrwind` and `dmatval` arrays.
- `mnel`: Integer array of length `ncol` containing the number of nonzero elements in each column. May be `NULL` if not required. This array is not required if the non-zero coefficients in the `mrwind` and `dmatval` arrays are continuous, and the `mstart` array has `ncol+1` entries as described above. It may be `NULL` if not required.
- `mrwind`: Integer arrays containing the row indices for the nonzero elements in each column. If the indices are input contiguously, with the columns in ascending order, then the length of `mrwind` is `mstart[ncol-1]+mnel[ncol-1]` or, if `mnel` is `NULL` , `mstart[ncol]` .
- `dmatval`: Double array containing the nonzero element values length as for `mrwind` .
- `dlb`: Double array of length `ncol` containing the lower bounds on the columns. Use `XPRS_MINUSINFINITY` to represent a lower bound of minus infinity.
- `dub`: Double array of length `ncol` containing the upper bounds on the columns. Use `XPRS_PLUSINFINITY` to represent an upper bound of plus infinity.
- `ngents`: Number of binary, integer, semi-continuous, semi-continuous integer and partial integer entities.
- `nsets`: Number of SOS1 and SOS2 sets.
- `qgtype`: Character array of length `ngents` containing the entity types:`B`: binary variables;`I`: integer variables;`P`: partial integer variables;`S`: semi-continuous variables;`R`: semi-continuous integer variables.
- `mgcols`: Integer array of length `ngents` containing the column indices of the global entities.
- `dlim`: Double array of length `ngents` containing the integer limits for the partial integer variables and lower bounds for semi-continuous and semi-continuous integer variables (any entries in the positions corresponding to binary and integer variables will be ignored). May be `NULL` if not required.
- `qstype`: Character array of length `nsets` containing the set types:`1`: SOS1 type sets;`2`: SOS2 type sets.May be `NULL` if not required.
- `msstart`: Integer array containing the offsets in the `mscols` and `dref` arrays indicating the start of the sets. This array is of length `nsets+1` , the last member containing the offset where set `nsets+1` would start. May be `NULL` if not required.
- `mscols`: Integer array of length `msstart[nsets]-1` containing the columns in each set. May be `NULL` if not required.
- `dref`: Double array of length `msstart[nsets]-1` containing the reference row entries for each member of the sets. May be `NULL` if not required.
"""
function loadglobal(prob::XpressProblem, _sprobname, ncols, nrows, _srowtypes, _drhs, _drange, _dobj, _mstart, _mnel, _mrwind, _dmatval, _dlb, _dub, ngents, nsets, _qgtype, _mgcols, _dlim, _stype, _msstart, _mscols, _dref)
@checked Lib.XPRSloadglobal(prob, _sprobname, ncols, nrows, _srowtypes, _drhs, _drange, _dobj, _mstart, _mnel, _mrwind, _dmatval, _dlb, _dub, ngents, nsets, _qgtype, _mgcols, _dlim, _stype, _msstart, _mscols, _dref)
end
function loadglobal64(prob::XpressProblem, _sprobname, ncols, nrows, _srowtypes, _drhs, _drange, _dobj, _mstart, _mnel, _mrwind, _dmatval, _dlb, _dub, ngents, nsets, _qgtype, _mgcols, _dlim, _stype, _msstart, _mscols, _dref)
@checked Lib.XPRSloadglobal64(prob, _sprobname, ncols, nrows, _srowtypes, _drhs, _drange, _dobj, _mstart, _mnel, _mrwind, _dmatval, _dlb, _dub, ngents, nsets, _qgtype, _mgcols, _dlim, _stype, _msstart, _mscols, _dref)
end
"""
int XPRS_CC XPRSaddnames(XPRSprob prob, int type, const char cnames[], int first, int last);
When a model is loaded, the rows, columns and sets of the model may not have names associated with them. This may not be important as the rows, columns and sets can be referred to by their sequence numbers. However, if you wish row, column and set names to appear in the ASCII solutions files, the names for a range of rows or columns can be added with `XPRSaddnames`.
### Arguments
- `prob`: The current problem.
- `type`: `1`: for row names;`2`: for column names.`3`: for set names.
- `cnames`: Character buffer containing the null-terminated string names.
- `first`: Start of the range of rows, columns or sets.
- `last`: End of the range of rows, columns or sets.
"""
function addnames(prob::XpressProblem, _itype::Integer, first::Integer, names::Vector{String})
"""
int XPRS_CC XPRSaddnames(XPRSprob prob, int type, const char cnames[], int first, int last);
When a model is loaded, the rows, columns and sets of the model may not have names associated with them. This may not be important as the rows, columns and sets can be referred to by their sequence numbers. However, if you wish row, column and set names to appear in the ASCII solutions files, the names for a range of rows or columns can be added with `XPRSaddnames`.
### Arguments
- `prob`: The current problem.
- `type`: `1`: for row names;`2`: for column names.`3`: for set names.
- `cnames`: Character buffer containing the null-terminated string names.
- `first`: Start of the range of rows, columns or sets.
- `last`: End of the range of rows, columns or sets.
"""
# TODO: name _itype a Enum?
NAMELENGTH = 64
last = first+length(names)-1
first -= 1
last -= 1
_cnames = ""
for str in names
_cnames = string(_cnames, join(Base.Iterators.take(str,NAMELENGTH)), "\0")
end
@checked Lib.XPRSaddnames(prob, Cint(_itype), _cnames, Cint(first), Cint(last))
end
function addnames(prob::XpressProblem, _itype::Integer, _sname::Vector{String})
addnames(prob, _itype, 1, _sname)
end
"""
int XPRS_CC XPRSaddsetnames(XPRSprob prob, const char names[], int first, int last);
When a model with global entities is loaded, any special ordered sets may not have names associated with them. If you wish names to appear in the ASCII solutions files, the names for a range of sets can be added with this function.
### Arguments
- `prob`: The current problem.
- `names`: Character buffer containing the null-terminated string names.
- `first`: Start of the range of sets.
- `last`: End of the range of sets.
"""
function addsetnames(prob::XpressProblem, _sname, first::Integer, last::Integer)
@checked Lib.XPRSaddsetnames(prob, _sname, first, last)
end
"""
int XPRS_CC XPRSscale(XPRSprob prob, const int mrscal[], const int mcscal[]);
Re-scales the current matrix.
### Arguments
- `prob`: The current problem.
- `mrscal`: Integer array of size ROWS containing the powers of `2` with which to scale the rows, or `NULL` if not required.
- `mcscal`: Integer array of size COLS containing the powers of `2` with which to scale the columns, or `NULL` if not required.
"""
function scale(prob::XpressProblem, mrscal, mcscal)
@checked Lib.XPRSscale(prob, mrscal, mcscal)
end
"""
int XPRS_CC XPRSreaddirs(XPRSprob prob, const char *filename);
Reads a directives file to help direct the global search.
### Arguments
- `prob`: The current problem.
- `filename`: A string of up to MAXPROBNAMELENGTH characters containing the file name from which the directives are to be read. If omitted (or `NULL` ), the default _problem_name_ is used with a `.dir` extension.
"""
function readdirs(prob::XpressProblem, _sfilename::String)
@checked Lib.XPRSreaddirs(prob, _sfilename)
end
"""
int XPRS_CC XPRSwritedirs(XPRSprob prob, const char *filename);
Writes the global search directives from the current problem to a directives file.
### Arguments
- `prob`: The current problem.
- `filename`: A string of up to MAXPROBNAMELENGTH characters containing the file name to which the directives should be written. If omitted (or NULL), the default _problem_name_ is used with a `.dir` extension.
"""
function writedirs(prob::XpressProblem, _sfilename::String)
@checked Lib.XPRSwritedirs(prob, _sfilename)
end
"""
int XPRS_CC XPRSsetindicators(XPRSprob prob, int nrows, const int mrows[], const int inds[], const int comps[]);
Specifies that a set of rows in the matrix will be treated as indicator constraints, during a global search. An indicator constraint is made of a `condition` and a `linear constraint`. The `condition` is of the type " `bin = value`", where `bin` is a binary variable and `value` is either 0 or 1. The `linear constraint` is any linear row. During global search, a row configured as an indicator constraint is enforced only when condition holds, that is only if the indicator variable `bin` has the specified value.
### Arguments
- `prob`: The current problem.
- `nrows`: The number of indicator constraints.
- `mrows`: Integer array of length `nrows` containing the indices of the rows that define the linear constraint part for the indicator constraints.
- `inds`: Integer array of length `nrows` containing the column indices of the indicator variables.
- `comps`: Integer array of length `nrows` with the complement flags:`0`: not an indicator constraint (in this case the corresponding entry in the `inds` array is ignored);`1`: for indicator constraints with condition " `bin = 1` ";`-1`: for indicator constraints with condition " `bin = 0` ";
"""
function setindicators(prob::XpressProblem, _mrows, _inds, _comps)
_mrows .-= 1
_inds .-= 1
nrows = length(_mrows)
@assert nrows == length(_inds)
@checked Lib.XPRSsetindicators(prob, nrows, _mrows, _inds, _comps)
end
"""
int XPRS_CC XPRSgetindicators(XPRSprob prob, int inds[], int comps[], int first, int last);
Returns the indicator constraint condition (indicator variable and complement flag) associated to the rows in a given range.
### Arguments
- `prob`: The current problem.
- `inds`: Integer array of length `last-first+1` where the column indices of the indicator variables are to be placed.
- `comps`: Integer array of length `last-first+1` where the indicator complement flags will be returned:`0`: not an indicator constraint (in this case the corresponding entry in the `inds` array is ignored);`1`: for indicator constraints with condition " `bin = 1` ";`-1`: for indicator constraints with condition " `bin = 0` ";
- `first`: First row in the range.
- `last`: Last row in the range (inclusive).
"""
function getindicators(prob::XpressProblem, _inds, _comps, first::Integer=1, last::Integer=0)
n_elems = last - first + 1
if n_elems <= 0
n_elems = n_constraints(prob)
first = 0
last = n_elems - 1
else
first = first - 1
last = last - 1
end
@assert n_elems == length(_inds) == length(_comps)
@checked Lib.XPRSgetindicators(prob, _inds, _comps, first, last)
_inds .+= 1
end
"""
int XPRS_CC XPRSdelindicators(XPRSprob prob, int first, int last);
Delete indicator constraints. This turns the specified rows into normal rows (not controlled by indicator variables).
### Arguments
- `prob`: The current problem.
- `first`: First row in the range.
- `last`: Last row in the range (inclusive).
"""
function delindicators(prob::XpressProblem, first::Integer, last::Integer)
@checked Lib.XPRSdelindicators(prob, first, last)
end
"""
int XPRS_CC XPRSdumpcontrols(XPRSprob prob);
Displays the list of controls and their current value for those controls that have been set to a non default value.
"""
function dumpcontrols(prob::XpressProblem)
@checked Lib.XPRSdumpcontrols(prob)
end
function minim(prob::XpressProblem, _sflags::String="")
@checked Lib.XPRSminim(prob, _sflags)
end
"""
int XPRS_CC XPRSmaxim(XPRSprob prob, const char *flags);
Begins a search for the optimal LP solution. These functions are deprecated and might be removed in a future release. XPRSlpoptimize or XPRSmipoptimize should be used instead.
### Arguments
- `prob`: The current problem.
- `flags`: Flags to pass to `XPRSmaxim` ( `MAXIM` ) or `XPRSminim` ( `MINIM` ). The default is `""` or `NULL` , in which case the algorithm used is determined by the DEFAULTALG control. If the argument includes:`b`: the model will be solved using the Newton barrier method;`p`: the model will be solved using the primal simplex algorithm;`d`: the model will be solved using the dual simplex algorithm;`l`: (lower case `L` ), the model will be solved as a linear model ignoring the discreteness of global variables;`n`: (lower case `N` ), the network part of the model will be identified and solved using the network simplex algorithm;`g`: the global model will be solved, calling XPRSglobal ( GLOBAL ).Certain combinations of options may be used where this makes sense so, for example, `pg` will solve the LP with the primal algorithm and then go on to perform the global search.
"""
function maxim(prob::XpressProblem, _sflags::String="")
@checked Lib.XPRSmaxim(prob, _sflags)
end
"""
int XPRS_CC XPRSlpoptimize(XPRSprob prob, const char *flags);
This function begins a search for the optimal continuous (LP) solution. The direction of optimization is given by OBJSENSE. The status of the problem when the function completes can be checked using LPSTATUS. Any global entities in the problem will be ignored.
### Arguments
- `prob`: The current problem.
- `flags`: Flags to pass to `XPRSlpoptimize` ( `LPOPTIMIZE` ). The default is `""` or `NULL` , in which case the algorithm used is determined by the DEFAULTALG control. If the argument includes:`b`: the model will be solved using the Newton barrier method;`p`: the model will be solved using the primal simplex algorithm;`d`: the model will be solved using the dual simplex algorithm;`n`: (lower case `N` ), the network part of the model will be identified and solved using the network simplex algorithm;