1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- /*#include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- int
- main( int argc, char *argv[] )
- {
- char buf[ 128 ];
- char x;
- char *px = &x;
- *px = 100;
- if( argc != 2 )
- {
- printf( "Braucht ein Argument!\n" );
- exit( 1 );
- }
- printf( argv[ 1 ] );
- putchar( '\n' );
- printf( "x = %d\n", x );
- printf( "Eingabe: " );
- fflush( stdout );
- if( fgets( buf, sizeof buf, stdin ) )
- printf( buf );
- printf( "x = %d\n", x );
- return 0;
- }
- */
- #include <ilcplex/ilocplex.h>
- #include <conio.h>
- #include <iostream>
- using namespace std;
- int main()
- {
- IloEnv env;
- IloModel mdl( env );
- IloNumVar x1;
- IloNumVar x2;
- IloRange sum_to_one( env, 1, 1 );
- IloObjective obj = IloMaximize( env, 0 );
- sum_to_one.setLinearCoef( x1, 1 );
- sum_to_one.setLinearCoef( x2, 1 );
- obj.setLinearCoef( x1, 2 );
- obj.setLinearCoef( x2, 1 );
- mdl.add( obj );
- mdl.add( sum_to_one );
- IloCplex solver( mdl );
- solver.solve();
- cout << solver.getObjValue() << "\n";
- getch();
- }
|