Assignment Writing Help – Everything Else

The aim of the website for life insurers is to offer students a one-stop solution for all academic questions. The company has LiveWebTutors as online assignment Help We offer expert assignment help in Australia, Sydney, Melbourne and the Assignment Writing Service. Hire Australian writing experts and get great grades in your class. Visit the website where we offer the best online help for jobs in Australia.

Assignment problem or something else?

My primary goal with this question is to identify the type of problem I have so that I know which solution to pursue. I think it's either an example of the assignment problem or the fair item assignment problem, but I can also think of a solution that involves varying the stable marriage problem.

Summary of the question: Is there a definition of the assignment problem where the solution is not to assign the first option to as many people as possible, but to assign the highest group preference level for assignments? A kind of altruistic group in which they prefer 1 to 2 weakly, but would be more satisfied with 2 if this means that another group member could get the 2nd instead of the 3rd choice?

Full context:

I come to these topics as a layperson, so I get lost in some of the formal notation and theory, although the concepts are generally clear enough. For me this is a down the rabbit hole situation. My wife has an event at work where she has to assign groups to projects. Usually she does it by hand and she asked me if there is a program that does it. I said, "There must be." Now that I know how much I don't know, I'm looking for a push in the right direction. πŸ™‚

Here is my scenario: 8 groups, 8 projects. Each group can have a project, each project a group. Each group specifies an ordinal preference for the desired project. The goal is to find the best combination of tasks for the entire group.

The assignment problem fits well, except, as I understand it, all the solutions are so valuable that as many agents as possible make their first choice or find the "least expensive" solution. In my scenario, the highest value solution is more what I would call "altruistic preferences", although there is probably a better, more formal term. In other words, if there is a scenario where 4 groups have the first choice, 2 groups have the fourth, 2 groups have the eighth choice, this is less preferable than a solution where everyone has the third choice. So the best solution could be that nobody makes their first choice.

Another way to define an acceptable solution is that the best result is one where A) the delta between the highest and lowest assigned preference is closest to 0 and B) the majority of assignments are strongly preferred (1 -4). So if everyone gets their 2-4, the delta is 2, and all choices are very preferred. If everyone gets 6-8, the same delta but low preference. The former is better.

These questions and answers made me investigate the problem of stable marriage, but the problem I encounter is that the projects have no preferences. So I figured, maybe I can do SMP with indifference, with one side completely indifferent. But my gut tells me that this is the same as the assignment problem. I need a version of the SMP in which one side is completely indifferent and the other side is only happy if the members as a whole have the highest possible preference, even if this means that nobody gets what they prefer most. I've started thinking about ways to do this, but if there is an existing model for the problem, I don't want to reinvent the wheel.

My next stop was the assignment of exhibition objects. I think this may be more like what I'm looking for, but I struggled to understand the different fairness criteria. It felt more complex than the problem I'm trying to solve, although I may be underestimating my problem.

I am tempted to send them to this Hungarian algorithm solver. I thought that might be a ready-made solution, but I made the mistake of thinking about it further. πŸ™‚ I don't think it would distinguish between a solution where one group gets their # 1 preference, six groups their # 2 and a group their # 3 and a solution where 8 groups get their # 2. At least not if I only take the settings as costs. These two scenarios would have the same total cost.

How do I connect the dots? Which of these problems do I actually have? Or have I missed a variation or misunderstood the goals of the solutions?

GUI design – assignment of tasks and status UI

To edit:

For example

Task A (Meaning: 500, category: II)

Task B (Meaning: 200, category I)

User:

User A – Participation: 50, Skills: 14, Categories: I, III, Value: Low

User B – Number of participants: 250, qualification: 5, categories: I, III, value: medium

User C – Number of participants: 175, qualification: 14, categories: II, value: medium

This system should build on conditions and criteria:

  1. The user can only get tasks from him category

(So ​​users B and A fail at startup) – The Task A is assigned automatically User C)

  1. Other important tasks are primarily dedicated to people with larger ones skill

(So, User C, don't have Category I for Task B – B and A remain because of the higher abilities of user A – he gets this task.)

Everything depends on the conditions and criteria you define. The possibilities are many – but it is worthwhile to keep everything to a minimum.


The main question is whether the tasks of a competent person or automatically?

I think the kind should be the same as the task category,

On what basis should the user value be measured? – I suggest a broader scale 1-10 – Instead of Low Medium High, calculated based on skills and attendance (calculated based on the number of tasks completed).

I go in a little further psychology – performing tasks should give satisfaction and satisfaction – You may want to think about it gamification and adding categories of tasks in which users feel best

  • motivation
  • price
  • The importance (of the task)

Based on what is it? user capability be measured?


It is important to remember that each parameter must be logically and contextually related in some way.

For example, presence with the number of tasks that were carried out in time (so you need to collect this data to calculate the next one)


In the context of soft management, it is impossible to categorize people in this way. usually a PM, assigns tasks based on their knowledge of the team.


This is a complex task for the interface design:

Areas to consider:

  • Create tasks
  • Assign tasks
  • Show users (lists)
  • CRUD tasks
  • to finish tasks

Enter image description here


amazon web services – port forwarding / assignment on AWS without load balancer – how did I do that?

I have a real puzzle in my hands.

I have a single Amazon EC2 instance that I set up about 6 months ago. An Apache HTTPD is executed on ports 81 (unsecured) and 8000 (secured). There is also a Tomcat running on port 8443. But the outside world sees Tomcat (secured) on 443.

No load balancing is involved (we have load balancing clusters; I know what that looks like).

The Tomcat and HTTPD servers run independently of each other.

When I execute a netstat instruction for the EC2 instance, it shows that 8443 is being bugged, but not 443. The active connector in Tomcat's server.xml contains a "proxyPort" clause for 443.

If I curl the Tomcat server on my desktop, I get something back to 443.
If I make a lock from the EC2 instance to localhost, I get nothing on 443. If I do this on 8443, I get a complaint that the certificate for "localhost" is wrong, so it obviously connects. The mapping between 443 and 8443 appears to be outside the instance.

And like a complete idiot, I made no notes of what I did to get this thing going. Can someone tell me what I did and how I did it? Or at least tell me what to look for? I see a security group, but it says nothing about port reassignment.

c – Safer and easier assignment functions and macros

I have written a number of functions and macros to make mapping more secure and easier. They are documented in their files.


Disclaimer:

The library needs POSIX extensions, GCC extensions and LIBBSD extensions, but if someone wants to make it portable, it shouldn't be difficult to remove the extensions I use. But for me they are a big help and make my life easier.

I use goto because it's cleaner for me (how I use it), but if someone wants to get rid of it, it should be easy.

I acknowledge an inconsistency in the parameter nmemb which is sometimes ptrdiff_t and some others size_t, I would always like to have it ptrdiff_t, but in macros that call standard functions (instead of mine) accept these standard functions size_t, and the code to reject negative values ​​of ptrdiff_t Within a macro, the macros would be too long and dangerous. In functions and in macros that call functions from me, I consistently use ptrdiff_t,


libalx/base/stdlib/alloc/README.rst:


============================

The following functions are added to the C / POSIX / GNU / BSD allocation
functions (some of them may be implemented as macros; only when necessary).


1) Headers
----------

.. code-block:: c

        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        

2) Functions
------------

.. code-block:: c

        ((gnu::nonnull))
        int     callocs(type **restrict ptr, size_t nmemb);

        ((gnu::malloc)) ((gnu::warn_unused_result))
        void    *mallocarray(ptrdiff_t nmemb, size_t size);

        ((gnu::nonnull)) ((gnu::warn_unused_result))
        int     mallocarrays(type **restrict ptr, ptrdiff_t nmemb);

        ((gnu::nonnull)) ((gnu::warn_unused_result))
        int     mallocs(void **restrict ptr, size_t size);

        ((gnu::warn_unused_result))
        void    *reallocarrayf(void *ptr, ptrdiff_t nmemb, size_t size);

        ((gnu::nonnull)) ((gnu::warn_unused_result))
        int     reallocarrayfs(type **restrict ptr, ptrdiff_t nmemb);

        ((gnu::nonnull))((gnu::warn_unused_result))
        int     reallocarrays(type **restrict ptr, ptrdiff_t nmemb);

        ((gnu::nonnull)) ((gnu::warn_unused_result))
        int     reallocfs(void **restrict ptr, size_t size);

        ((gnu::nonnull)) ((gnu::warn_unused_result))
        int     reallocs(void **restrict ptr, size_t size);

To be able to use any of those functions, the corresponding headers should be
included.

3) When to use each of the functions
------------------------------------

Functions ending in ``s`` should always be preferred.

Reallocation functions ending in ``f`` (or ``fs``) free the memory upon
failure to ease error handling.

Functions containing ``array`` (and ``callocs()``) should be used when
allocating arrays, or single elements (arrays of size 1).  The other funtions
should be used when and only when dealing with buffers of bytes.

4) More info
------------

For more detailed documentation about each of the functions, read the
corresponding headers.

libalx/base/stdlib/alloc/callocs.h:

/******************************************************************************
 ******* include guard ********************************************************
 ******************************************************************************/
#pragma once    /* libalx/base/stdlib/alloc/callocs.h */


/******************************************************************************
 ******* about ****************************************************************
 ******************************************************************************/
/*
 * ((gnu::nonnull))
 * int  callocs(type **restrict ptr, size_t nmemb);
 *
 * Safe & simple wrapper for `calloc()`.
 *
 * Features:
 * - Safely computes the element size (second argument to `calloc()`)
 *      so the user can't make mistakes.
 * - Returns non-zero on error.
 * - Doesn't cast
 * - The pointer stored in `*ptr` is always a valid pointer or NULL.
 *
 * example:
 *      #define ALX_NO_PREFIX
 *      #include 
 *
 *              int *arr;
 *
 *              if (callocs(&arr, 7))           // int arr(7);
 *                      goto err;
 *
 *              // `arr` has been succesfully allocated here
 *              free(arr);
 *      err:
 *              // No memory leaks
 */


/******************************************************************************
 ******* headers **************************************************************
 ******************************************************************************/
#include 


/******************************************************************************
 ******* macros ***************************************************************
 ******************************************************************************/
/*
 * callocs()
 *
 * ptr:         Memory will be allocated, and a pointer to it will be stored
 *              in *ptr.
 * nmemb:       Number of elements in the array.
 *
 * return:
 *      0:              OK.
 *      != 0:           Failed.
 */
#define alx_callocs(ptr, nmemb) (                                       
{                                                                       
        __auto_type     ptr_    = (ptr);                                
                                                                        
        *ptr_   = calloc(nmemb, sizeof(**ptr_));                        
                                                                        
        !(*ptr_);                                                       
}                                                                       
)


/* Rename without alx_ prefix */
#if defined(ALX_NO_PREFIX)
#define callocs(ptr, nmemb)     alx_callocs(ptr, nmemb)
#endif


/******************************************************************************
 ******* enum *****************************************************************
 ******************************************************************************/


/******************************************************************************
 ******* struct / union *******************************************************
 ******************************************************************************/


/******************************************************************************
 ******* prototypes ***********************************************************
 ******************************************************************************/


/******************************************************************************
 ******* inline ***************************************************************
 ******************************************************************************/


/******************************************************************************
 ******* end of file **********************************************************
 ******************************************************************************/

libalx/base/stdlib/alloc/mallocarray.h:

/******************************************************************************
 ******* include guard ********************************************************
 ******************************************************************************/
#pragma once    /* libalx/base/stdlib/alloc/mallocarray.h */


/******************************************************************************
 ******* about ****************************************************************
 ******************************************************************************/
/*
 * ((gnu::malloc)) ((gnu::warn_unused_result))
 * void *mallocarray(ptrdiff_t nmemb, size_t size);
 *
 * Almost equivalent to `reallocarray(NULL, nmemb, size)`.
 *
 * Features:
 * - It fails safely if (nmemb < 0).  With `reallocarray()` the array would be
 *      be allocated (it uses `size_t` instead of `ptrdiff_t`), and it's usage
 *      would likely produce undefined behavior.
 *
 * example:
 *      #define ALX_NO_PREFIX
 *      #include 
 *
 *              int *arr;
 *
 *              arr     = mallocarray(7, sizeof(*arr));         // int arr(7);
 *              if (!arr)
 *                      goto err;
 *
 *              // `arr` has been succesfully allocated here
 *              free(arr);
 *      err:
 *              // No memory leaks
 */


/******************************************************************************
 ******* headers **************************************************************
 ******************************************************************************/
#include 
#include 
#include 


/******************************************************************************
 ******* macros ***************************************************************
 ******************************************************************************/


/******************************************************************************
 ******* enum *****************************************************************
 ******************************************************************************/


/******************************************************************************
 ******* struct / union *******************************************************
 ******************************************************************************/


/******************************************************************************
 ******* prototypes ***********************************************************
 ******************************************************************************/
/*
 * mallocarray()
 *
 * nmemb:       Number of elements in the array.
 * size:        Size of each element in the array.
 *
 * return:
 *      != NULL:        OK.
 *      NULL:           Failed.
 */
__attribute__((malloc, warn_unused_result))
inline
void    *alx_mallocarray        (ptrdiff_t nmemb, size_t size);


/******************************************************************************
 ******* static inline ********************************************************
 ******************************************************************************/
/* Rename without alx_ prefix */
#if defined(ALX_NO_PREFIX)
__attribute__((always_inline, malloc, warn_unused_result))
static inline
void    *mallocarray            (ptrdiff_t nmemb, size_t size)
{
        return  alx_mallocarray(nmemb, size);
}
#endif


/******************************************************************************
 ******* inline ***************************************************************
 ******************************************************************************/
inline
void    *alx_mallocarray        (ptrdiff_t nmemb, size_t size)
{

        if (nmemb < 0)
                goto ovf;

        return  reallocarray(NULL, nmemb, size);
ovf:
        errno   = ENOMEM;
        return  NULL;
}


/******************************************************************************
 ******* end of file **********************************************************
 ******************************************************************************/

libalx/base/stdlib/alloc/mallocarrays.h:

/******************************************************************************
 ******* include guard ********************************************************
 ******************************************************************************/
#pragma once    /* libalx/base/stdlib/alloc/mallocarrays.h */


/******************************************************************************
 ******* about ****************************************************************
 ******************************************************************************/
/*
 * ((gnu::nonnull)) ((gnu::warn_unused_result))
 * int  mallocarrays(type **restrict ptr, ptrdiff_t nmemb);
 *
 * Safe & simple wrapper for `mallocarray()`.
 *
 * Features:
 * - Safely computes the element size (second argument to `mallocarray()`)
 *      so the user can't make mistakes.
 * - Returns non-zero on error.
 * - Doesn't cast
 * - The pointer stored in `*ptr` is always a valid pointer or NULL.
 *
 * example:
 *      #define ALX_NO_PREFIX
 *      #include 
 *
 *              int *arr;
 *
 *              if (mallocarrays(&arr, 7))              // int arr(7);
 *                      goto err;
 *
 *              // `arr` has been succesfully allocated here
 *              free(arr);
 *      err:
 *              // No memory leaks
 */


/******************************************************************************
 ******* headers **************************************************************
 ******************************************************************************/
#include 
#include 
#include 
#include 

#include "libalx/base/stdlib/alloc/mallocarray.h"


/******************************************************************************
 ******* macros ***************************************************************
 ******************************************************************************/
/*
 * mallocarrays()
 *
 * ptr:         Memory will be allocated, and a pointer to it will be stored
 *              in *ptr.
 * nmemb:       Number of elements in the array.
 *
 * return:
 *      0:              OK.
 *      != 0:           Failed.
 */
#define alx_mallocarrays(ptr, nmemb)    (                               
{                                                                       
        __auto_type     ptr_    = (ptr);                                
                                                                        
        *ptr_   = alx_mallocarray(nmemb, sizeof(**ptr_));               
                                                                        
        !(*ptr_);                                                       
}                                                                       
)


/* Rename without alx_ prefix */
#if defined(ALX_NO_PREFIX)
#define mallocarrays(ptr, nmemb)        alx_mallocarrays(ptr, nmemb)
#endif


/******************************************************************************
 ******* enum *****************************************************************
 ******************************************************************************/


/******************************************************************************
 ******* struct / union *******************************************************
 ******************************************************************************/


/******************************************************************************
 ******* function prototypes **************************************************
 ******************************************************************************/


/******************************************************************************
 ******* inline functions *****************************************************
 ******************************************************************************/


/******************************************************************************
 ******* end of file **********************************************************
 ******************************************************************************/

libalx/base/stdlib/alloc/mallocs.h:

/******************************************************************************
 ******* include guard ********************************************************
 ******************************************************************************/
#pragma once    /* libalx/base/stdlib/alloc/mallocs.h */


/******************************************************************************
 ******* about ****************************************************************
 ******************************************************************************/
/*
 * ((gnu::nonnull))  ((gnu::warn_unused_result))
 * int  mallocs(void **restrict ptr, size_t size);
 *
 * Safe & simple wrapper for `malloc()`.
 * To be used for generic buffers of bytes, and not for arrays (use
 * `mallocarray()` family of functions for that purpose).
 *
 * Features:
 * - Returns non-zero on error.
 * - Doesn't cast
 * - The pointer stored in `*ptr` is always a valid pointer or NULL.
 *
 * example:
 *      #define ALX_NO_PREFIX
 *      #include 
 *
 *              char *buf;
 *
 *              if (mallocs(&buf, 7))           // char buf(7);
 *                      goto err;
 *
 *              // `buf` has been succesfully allocated here
 *              free(buf);
 *      err:
 *              // No memory leaks
 */


/******************************************************************************
 ******* headers **************************************************************
 ******************************************************************************/
#include 
#include 


/******************************************************************************
 ******* macros ***************************************************************
 ******************************************************************************/


/******************************************************************************
 ******* enum *****************************************************************
 ******************************************************************************/


/******************************************************************************
 ******* struct / union *******************************************************
 ******************************************************************************/


/******************************************************************************
 ******* prototypes ***********************************************************
 ******************************************************************************/
/*
 * mallocs()
 *
 * ptr:         Memory will be allocated, and a pointer to it will be stored
 *              in *ptr.
 * size:        Size of the buffer (in bytes).
 *
 * return:
 *      0:              OK.
 *      != 0:           Failed.
 */
__attribute__((nonnull, warn_unused_result))
inline
int     alx_mallocs     (void **restrict ptr, size_t size);


/******************************************************************************
 ******* static inline ********************************************************
 ******************************************************************************/
/* Rename without alx_ prefix */
#if defined(ALX_NO_PREFIX)
__attribute__((always_inline, nonnull, warn_unused_result))
static inline
int     mallocs         (void **restrict ptr, size_t size)
{
        return  alx_mallocs(ptr, size);
}
#endif


/******************************************************************************
 ******* inline ***************************************************************
 ******************************************************************************/
inline
int     alx_mallocs     (void **restrict ptr, size_t size)
{

        *ptr    = malloc(size);

        return  !(*ptr);
}


/******************************************************************************
 ******* end of file **********************************************************
 ******************************************************************************/

libalx/base/stdlib/alloc/reallocarrayf.h:

/******************************************************************************
 ******* include guard ********************************************************
 ******************************************************************************/
#pragma once    /* libalx/base/stdlib/alloc/reallocarrayf.h */


/******************************************************************************
 ******* about ****************************************************************
 ******************************************************************************/
/*
 * ((gnu::warn_unused_result))
 * void *reallocarrayf(void *ptr, ptrdiff_t nmemb, size_t size);
 *
 * Almost equivalent to `reallocarray()`.
 *
 * Features:
 * - Upon failure, the passed pointer is freed, to ease error handling and to
 *      avoid memory leaks.
 * - It fails safely if (nmemb < 0).  With `reallocarray()` the array would be
 *      be allocated (it uses `size_t` instead of `ptrdiff_t`), and it's usage
 *      would likely produce undefined behavior.
 *
 * example:
 *      #define ALX_NO_PREFIX
 *      #include 
 *
 *              int *arr;
 *
 *              arr     = mallocarray(5, sizeof(*arr);          // int arr(5);
 *              arr     = reallocarrayf(arr, 7, sizeof(*arr));  // int arr(7);
 *              if (!arr)
 *                      goto err;
 *
 *              // `arr` has been succesfully reallocated here
 *              free(arr);
 *      err:
 *              // No memory leaks
 */


/******************************************************************************
 ******* headers **************************************************************
 ******************************************************************************/
#include 
#include 
#include 
#include 


/******************************************************************************
 ******* _Static_assert *******************************************************
 ******************************************************************************/
_Static_assert(sizeof(size_t) == sizeof(ptrdiff_t),
                                "sizeof(size_t) != sizeof(ptrdiff_t)");


/******************************************************************************
 ******* macros ***************************************************************
 ******************************************************************************/


/******************************************************************************
 ******* enum *****************************************************************
 ******************************************************************************/


/******************************************************************************
 ******* struct / union *******************************************************
 ******************************************************************************/


/******************************************************************************
 ******* prototypes ***********************************************************
 ******************************************************************************/
/*
 * reallocarrayf()
 *
 * ptr:         Pointer to allocated memory (or NULL).
 * nmemb:       Number of elements in the array.
 * size:        Size of each element in the array.
 *
 * return:
 *      != NULL:        OK.
 *      NULL:           Failed.
 */
__attribute__((warn_unused_result))
inline
void    *alx_reallocarrayf      (void *ptr, ptrdiff_t nmemb, size_t size);


/******************************************************************************
 ******* static inline ********************************************************
 ******************************************************************************/
/* Rename without alx_ prefix */
#if defined(ALX_NO_PREFIX)
__attribute__((always_inline, warn_unused_result))
static inline
void    *reallocarrayf          (void *ptr, ptrdiff_t nmemb, size_t size)
{
        return  alx_reallocarrayf(ptr, nmemb, size);
}
#endif


/******************************************************************************
 ******* inline ***************************************************************
 ******************************************************************************/
inline
void    *alx_reallocarrayf      (void *ptr, ptrdiff_t nmemb, size_t size)
{

        if (!size)
                goto out;
        if (nmemb < 0)
                goto ovf;
        if ((size_t)nmemb  >  (SIZE_MAX / size))
                goto ovf;

        return  reallocf(ptr, size * (size_t)nmemb);
ovf:
        errno   = ENOMEM;
out:
        free(ptr);
        return  NULL;
}


/******************************************************************************
 ******* end of file **********************************************************
 ******************************************************************************/

libalx/base/stdlib/alloc/reallocarrayfs.h:

/******************************************************************************
 ******* include guard ********************************************************
 ******************************************************************************/
#pragma once    /* libalx/base/stdlib/alloc/reallocarrayfs.h */


/******************************************************************************
 ******* about ****************************************************************
 ******************************************************************************/
/*
 * ((gnu::nonnull)) ((gnu::warn_unused_result))
 * int  reallocarrayfs(type **restrict ptr, ptrdiff_t nmemb);
 *
 * Safe & simple wrapper for `reallocarrayf()`.
 *
 * Features:
 * - Safely computes the element size (second argument to `reallocarrayf()`)
 *      so the user can't make mistakes.
 * - Returns non-zero on error.
 * - Doesn't cast.
 * - Upon failure, the passed pointer is freed, to ease error handling and to
 *      avoid memory leaks.
 * - It fails safely if (nmemb < 0).  With `reallocarray()` the array would be
 *      be allocated (it uses `size_t` instead of `ptrdiff_t`), and it's usage
 *      would likely produce undefined behavior.
 * - The pointer stored in `*ptr` is always a valid pointer or NULL.
 *
 * example:
 *      #define ALX_NO_PREFIX
 *      #include 
 *
 *              int *arr;
 *
 *              if (mallocarrays(&arr, 5))      // int arr(5);
 *                      goto err;
 *              if (reallocarrayfs(&arr, 7))    // int arr(7);
 *                      goto err;
 *
 *              // `arr` has been succesfully reallocated here
 *              free(arr);
 *      err:
 *              // No memory leaks
 */


/******************************************************************************
 ******* headers **************************************************************
 ******************************************************************************/
#include "libalx/base/stdlib/alloc/reallocarrayf.h"


/******************************************************************************
 ******* macros ***************************************************************
 ******************************************************************************/
/*
 * reallocarrayfs()
 *
 * ptr:         Pointer to a pointer to the memory to be reallocated.
 *              A pointer to the reallocated memory will be stored
 *              in *ptr.
 * nmemb:       Number of elements in the array.
 *
 * return:
 *      0:              OK.
 *      != 0:           Failed.
 */
#define alx_reallocarrayfs(ptr, nmemb)  (                               
{                                                                       
        __auto_type     ptr_    = (ptr);                                
                                                                        
        *ptr_   = alx_reallocarrayf(*ptr_, nmemb, sizeof(**ptr_));      
                                                                        
        !(*ptr_);                                                       
}                                                                       
)


/* Rename without alx_ prefix */
#if defined(ALX_NO_PREFIX)
#define reallocarrayfs(ptr, nmemb)      alx_reallocarrayfs(ptr, nmemb)
#endif


/******************************************************************************
 ******* enum *****************************************************************
 ******************************************************************************/


/******************************************************************************
 ******* struct / union *******************************************************
 ******************************************************************************/


/******************************************************************************
 ******* function prototypes **************************************************
 ******************************************************************************/


/******************************************************************************
 ******* inline functions *****************************************************
 ******************************************************************************/


/******************************************************************************
 ******* end of file **********************************************************
 ******************************************************************************/

libalx/base/stdlib/alloc/reallocarrays.h:

/******************************************************************************
 ******* include guard ********************************************************
 ******************************************************************************/
#pragma once    /* libalx/base/stdlib/alloc/reallocarrays.h */


/******************************************************************************
 ******* about ****************************************************************
 ******************************************************************************/
/*
 * ((gnu::nonnull))((gnu::warn_unused_result))
 * int  reallocarrays(type **restrict ptr, size_t nmemb);
 *
 * Safe & simple wrapper for `reallocarray()`.
 *
 * Features:
 * - Safely computes the element size (second argument to `reallocarray()`)
 *      so the user can't make mistakes.
 * - Returns non-zero on error.
 * - Doesn't cast.
 * - Upon failure, the pointer is untouched (no memory leak).
 * - The pointer stored in `*ptr` is always a valid pointer or NULL.
 *
 * example:
 *      #define ALX_NO_PREFIX
 *      #include 
 *
 *              int *arr;
 *
 *              if (mallocarrays(&arr, 5))      // int arr(5);
 *                      goto err;
 *              if (reallocarrays(&arr, 7))     // int arr(7);
 *                      goto err;
 *
 *              // `arr` has been succesfully reallocated here
 *      err:
 *              free(arr);
 *              // No memory leaks
 */


/******************************************************************************
 ******* headers **************************************************************
 ******************************************************************************/
#include 

#include "libalx/base/stdlib/alloc/reallocs.h"


/******************************************************************************
 ******* macros ***************************************************************
 ******************************************************************************/
/*
 * reallocarrays()
 *
 * ptr:         Pointer to a pointer to the memory to be reallocated.
 *              A pointer to the reallocated memory will be stored
 *              in *ptr.
 * nmemb:       Number of elements in the array.
 *
 * return:
 *      0:              OK.
 *      != 0:           Failed.
 */
#define alx_reallocarrays(ptr, nmemb)   (                               
{                                                                       
        __auto_type     ptr_    = (ptr);                                
        __auto_type     nmemb_  = (nmemb);                              
        void            *vp_;                                           
                                                                        
        vp_     = reallocarray(*ptr_, nmemb_, sizeof(**ptr_));          
                                                                        
        alx_reallocs__(ptr_, vp_, nmemb_);                              
}                                                                       
)


/* Rename without alx_ prefix */
#if defined(ALX_NO_PREFIX)
#define reallocarrays(ptr, nmemb)       alx_reallocarrays(ptr, nmemb)
#endif


/******************************************************************************
 ******* enum *****************************************************************
 ******************************************************************************/


/******************************************************************************
 ******* struct / union *******************************************************
 ******************************************************************************/


/******************************************************************************
 ******* function prototypes **************************************************
 ******************************************************************************/


/******************************************************************************
 ******* inline functions *****************************************************
 ******************************************************************************/


/******************************************************************************
 ******* end of file **********************************************************
 ******************************************************************************/

libalx/base/stdlib/alloc/reallocfs.h:

/******************************************************************************
 ******* include guard ********************************************************
 ******************************************************************************/
#pragma once    /* libalx/base/stdlib/alloc/reallocfs.h */


/******************************************************************************
 ******* about ****************************************************************
 ******************************************************************************/
/*
 * ((gnu::nonnull)) ((gnu::warn_unused_result))
 * int  reallocfs(void **restrict ptr, size_t size);
 *
 * Safe & simple wrapper for `reallocf()`.
 * To be used for generic buffers of bytes, and not for arrays (use
 * `reallocarray()` family of functions for that purpose).
 *
 * Features:
 * - Returns non-zero on error.
 * - Doesn't cast.
 * - Upon failure, the passed pointer is freed, to ease error handling and to
 *      avoid memory leaks.
 * - The pointer stored in `*ptr` is always a valid pointer or NULL.
 *
 * example:
 *      #define ALX_NO_PREFIX
 *      #include 
 *
 *              char *buf;
 *
 *              if (mallocs(&buf, 5))   // char buf(5);
 *                      goto err;
 *              if (reallocfs(&buf, 7)) // char buf(7);
 *                      goto err;
 *
 *              // `buf` has been succesfully reallocated here
 *              free(buf);
 *      err:
 *              // No memory leaks
 */


/******************************************************************************
 ******* headers **************************************************************
 ******************************************************************************/
#include 
#include 


/******************************************************************************
 ******* macros ***************************************************************
 ******************************************************************************/


/******************************************************************************
 ******* enum *****************************************************************
 ******************************************************************************/


/******************************************************************************
 ******* struct / union *******************************************************
 ******************************************************************************/


/******************************************************************************
 ******* prototypes ***********************************************************
 ******************************************************************************/
/*
 * reallocfs()
 *
 * ptr:         Pointer to a pointer to the memory to be reallocated.
 *              A pointer to the reallocated memory will be stored
 *              in *ptr.
 * size:        Size of the buffer (in bytes).
 *
 * return:
 *      0:              OK.
 *      != 0:           Failed.
 */
__attribute__((nonnull, warn_unused_result))
inline
int     alx_reallocfs   (void **restrict ptr, size_t size);


/******************************************************************************
 ******* static inline ********************************************************
 ******************************************************************************/
/* Rename without alx_ prefix */
#if defined(ALX_NO_PREFIX)
__attribute__((always_inline, nonnull, warn_unused_result))
static inline
int     reallocfs       (void **restrict ptr, size_t size)
{
        return  alx_reallocfs(ptr, size);
}
#endif


/******************************************************************************
 ******* inline ***************************************************************
 ******************************************************************************/
inline
int     alx_reallocfs   (void **restrict ptr, size_t size)
{

        *ptr    = reallocf(*ptr, size);

        return  !*ptr;
}


/******************************************************************************
 ******* end of file **********************************************************
 ******************************************************************************/

libalx/base/stdlib/alloc/reallocs.h:

/******************************************************************************
 ******* include guard ********************************************************
 ******************************************************************************/
#pragma once    /* libalx/base/stdlib/alloc/reallocs.h */


/******************************************************************************
 ******* about ****************************************************************
 ******************************************************************************/
/*
 * ((gnu::nonnull)) ((gnu::warn_unused_result))
 * int  reallocs(void **restrict ptr, size_t size);
 *
 * Safe & simple wrapper for `reallocf()`.
 * To be used for generic buffers of bytes, and not for arrays (use
 * `reallocarray()` family of functions for that purpose).
 *
 * Features:
 * - Returns non-zero on error.
 * - Doesn't cast.
 * - Upon failure, the pointer is untouched (no memory leak).
 * - The pointer stored in `*ptr` is always a valid pointer or NULL.
 *
 * example:
 *      #define ALX_NO_PREFIX
 *      #include 
 *
 *              char *buf;
 *
 *              if (mallocs(&buf, 5))   // char buf(5);
 *                      goto err;
 *              if (reallocs(&buf, 7))  // char buf(7);
 *                      goto err;
 *
 *              // `buf` has been succesfully reallocated here
 *      err:
 *              free(buf);
 *              // No memory leaks
 */


/******************************************************************************
 ******* headers **************************************************************
 ******************************************************************************/
#include 
#include 
#include 


/******************************************************************************
 ******* macros ***************************************************************
 ******************************************************************************/


/******************************************************************************
 ******* enum *****************************************************************
 ******************************************************************************/


/******************************************************************************
 ******* struct / union *******************************************************
 ******************************************************************************/


/******************************************************************************
 ******* prototypes ***********************************************************
 ******************************************************************************/
/*
 * reallocs()
 *
 * ptr:         Pointer to a pointer to the memory to be reallocated.
 *              A pointer to the reallocated memory will be stored
 *              in *ptr.
 * size:        Size of the buffer (in bytes).
 *
 * return:
 *      0:              OK.
 *      != 0:           Failed.
 */
__attribute__((nonnull, warn_unused_result))
inline
int     alx_reallocs    (void **restrict ptr, size_t size);

/*
 * alx_reallocs__()
 *
 * This function safely assigns the result of a reallocation to the pointer
 * provided.  If the reallocation failed, this function doesn't assign the
 * pointer, and keeps the old one.  This function is only to be used within
 * this library, and should not be called directly by the user.
 *
 * ptr:         Pointer to a pointer to the memory to be reallocated.
 *              A pointer to the reallocated memory will be stored
 *              in *ptr.
 * vp:          Result of `realloc()`.
 * size:        `size` passed to `realloc()`.
 *
 * return:
 *      0:              OK.
 *      != 0:           Reallocation failed.
 */
__attribute__((nonnull(1), warn_unused_result))
inline
int     alx_reallocs__  (void **restrict ptr, void *restrict vp, size_t size);


/******************************************************************************
 ******* static inline ********************************************************
 ******************************************************************************/
/* Rename without alx_ prefix */
#if defined(ALX_NO_PREFIX)
__attribute__((always_inline, nonnull, warn_unused_result))
static inline
int     reallocs        (void **restrict ptr, size_t size)
{
        return  alx_reallocs(ptr, size);
}
#endif


/******************************************************************************
 ******* inline ***************************************************************
 ******************************************************************************/
inline
int     alx_reallocs    (void **restrict ptr, size_t size)
{
        void    *vp;

        vp      = realloc(*ptr, size);

        return  alx_reallocs__(ptr, vp, size);
}

inline
int     alx_reallocs__  (void **restrict ptr, void *restrict vp, size_t size)
{
        bool    failed;

        failed  = !vp && size;
        if (!failed)
                *ptr    = vp;

        return  failed;
}


/******************************************************************************
 ******* end of file **********************************************************
 ******************************************************************************/

Any comments?

linear programming – calculation of an optimal integer assignment with an optimal LP solution

I modeled an ILP where I have a number of outfits and I am friends with , all these friends should put on an outfit with minimal effort taking into account the fact that these outfits differ in size, body shape and fit. The solution should look like this:

with the next restrictions:

The relaxation to LP should be set:

Well, considering we don't have one integrity gap In this problem there is an integral for each fractional LP solution
Feasible solution with the same costs, how can we give a polynomial-time algorithm that calculates such an optimal integer assignment from any given optimal LP solution.

Software engineering – assignment of pseudocodes and problem definitions (Java)

Pseudocode:
Use your problem definition statement from step 1 for our Java Airlines case study to explain the functionality of the software you want to develop using pseudocode. I have to have it in Java.

Problem definition:
To create a problem definition, write down a few sample questions you would ask the President of Java Airlines to better help what the software should do. Be creative in your questions!
Write a trailing problem definition statement to summarize what you think the Java Airline software should look like.
The attention to detail is rated with the full number of points in this order.

Please help me with these questions and answer them step by step, even if you use Java.

java – assignment of problem definitions

To create a problem definition, write down a few sample questions that you would ask the President of Java Airlines to better help what the software should do. Be creative in your questions!
Write a trailing problem definition statement to summarize what you think the Java Airline software should look like.
The attention to detail is rated with the full number of points in this order.

Would someone explain or summarize what I should do?

api design – operand order for matrix multiplication with assignment

If you have a matrix class with overload operator*=in which order the operands should be placed so that the interface is useful and intuitive. you can choose A *= B be either equivalent A = A*B, or A = B*A, From a viewpoint A*=B It looks like it should do the first (as Octave implements it), but put B left is more practical because matrices are always stacked on the left. Especially if A is a column vector and B is then a rotation matrix A *= B would accumulate rotations on Aand the other convention would not even work.

Instead of using operator*=You could also name like leftmul and rightmulbut it is not obvious which of these two options is one.

Programming Languages ​​- Why is the assignment rule in Hoare Logic as it is?

Why is the assignment rule in Hoare Logic / Axiomatic Semantics?
I can not worry about why the assignment rule is different from what I expected.

I understand that hoare logic is used to prove formal statements about the state of a program when executing commands. So, when we execute the command $$ x: = e $$ I would have expected that Next State has such a substitution … but it seems that the substitution happens In front we execute the order from the bizzare I find. I would have expected:

$$ {P } x: = e {P [e / x] } $$

In the face of that $ P $ are statements about the program state.

I'm sure there is a good explanation for that and apologize if this is a fundamental question, I know it has to be that way. But can someone explain it to me?


Related posts I read and did not help: